Revision cbafea1955029ee05736cc2d05f765e4b5ef8295

Committed on 31/08/2017 3:40 pm by Jérôme Vieilledent <lolautruche@gmail.com> [GitHub Diff]

Fix #37: Add expression support in configured view parameters

This implements support for Expressions for variables injection into content views.

```yaml
ezpublish:
system:
my_siteaccess:
location_view:
full:
article_test:
template: "AcmeTestBundle:full:article_test.html.twig"
params:
parentLocation:
expression: "loadLocation(location.parentLocationId)"
metadata:
expression: "{
'contentTypeIdentifier': contentType.identifier,
'section': repository.getSectionService().loadSection(content.contentInfo.sectionId),
'owner': repository.getUserService().loadUser(content.contentInfo.ownerId),
'secret': '%secret%'
}"
match:
Id\Location: 144
```

In order to build your expressions, several variables and functions are exposed

| Variable name | Type | Description |
|------------------|-------------------------------------------------------------|---------------------------------------|
| `view` | `Lolautruche\EzCoreExtraBundle\View\ConfigurableView` | The **content view** being configured |
| `content` | `eZ\Publish\Core\Repository\Values\Content\Content` | Current content |
| `location` | `eZ\Publish\Core\Repository\Values\Content\Location` | Current location |
| `contentType` | `eZ\Publish\Core\Repository\Values\ContentType\ContentType` | ContentType of the current content |
| `configResolver` | `eZ\Publish\Core\MVC\ConfigResolverInterface` | The ConfigResolver |
| `repository` | `eZ\Publish\Core\Repository\Repository` | The content repository |

| Function name | Description |
|-------------------|----------------------------------|
| `loadLocation` | Loads a location object by ID |
| `loadContent` | Loads a content object by ID |
| `loadContentType` | Loads a contentType object by ID |