Giter Club home page Giter Club logo

ezplatform-query-fieldtype's Introduction

eZ Platform Query Field Type

This Field Type will let a content manager map an executable Repository Query to a Field.

Example use-cases:

  • a place.nearby_places field that returns Place items less than X kilometers away from the current content, based on its own location field
  • a gallery.images field that returns Image items that are children of the current gallery item's main location

The idea is to move content and structure logic implemented in controllers and templates to the repository itself.

Installation

Add the package to the requirements:

composer require ezsystems/ezplatform-query-fieldtype:^1.0@dev

Add the package to app/AppKernel.php:

$bundles = [
  // ...
  new EzSystems\EzPlatformQueryFieldType\Symfony\EzSystemsEzPlatformQueryFieldTypeBundle(),
];

Add the bundle routes to app/config/routing.yml:

ezplatform.query_fieldtype.routes:
    resource: '@BDEzPlatformQueryFieldTypeBundle/Resources/config/routing/'
    type: directory

Usage

Add a query field to a content type.

In the Field Definition settings, select a Query Type out of the ones defined in the system, as well as the content type that is returned by that field.

Parameters are used to get the query type's parameters, on runtime, based on properties from the content item. The syntax for it is YAML.. The key is the name of a query type parameter, and the value either a scalar, or an expression.

A simple example, for a LocationChildren query type that expects:

  • parent_location_id: id of the location to fetch children for
  • content_types: content type identifier or array of identifiers to filter on
parent_location_id: "@=content.contentInfo.mainLocationId"
content_types: "image"

See the examples directory for full examples.

ezplatform-query-fieldtype's People

Contributors

arfaram avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.