Symfony/eZ5 bundle for KeyMedia
- eZ Publish 5.x
- The KeyMedia legacy extension
And if you want a better user experience;
Install via Composer – add the following to your composer.json
:
{
"repositories": [
...
{
"type": "git",
"url": "[email protected]:KeyteqLabs/KeyMediaBundle.git"
}
],
"require": {
...
"keyteqlabs/keymediabundle": "dev-master"
}
}
Run a Composer update, and the bundle will be automagically installed.
First, activate the bundle in your EzPublishKernel.php
:
$bundles = array(
...
new KTQ\Bundle\KeyMediaBundle\KTQKeyMediaBundle(),
);
Then, in your global parameters.yml
, define which siteaccess or siteaccess group KeyMedia should be activated for. Make sure you don’t activate it for your admin (back office) siteaccess, else some of its views will get borked.
The cleanest way to do this is probably to define a separate group for the frontend siteaccess:
ezpublish:
siteaccess:
default_siteaccess: mysite
list:
- mysite
- eng
- nor
- mysite_admin
groups:
common_group:
- mysite
- eng
- nor
- mysite_admin
frontend_group:
- mysite
- eng
- nor
The setting parameters.keymedia_active_siteaccess
should then be added to parameters.yml
like this:
parameters:
keymedia_active_siteaccess: frontend_group
It’s quite similar to the legacy way of doing things – attribute_view_gui
has become ez_render_field
, and the syntax is slightly different due to the switch to Twig:
{{ ez_render_field(content, 'my_keymedia_field_identifier', {
format: 'My-named-downscale',
quality: 90,
title: 'My descriptive alternative text'
}) }}
If you don’t want to use any of the named downscales, you can provide an array with width and height values just as before;
{{ ez_render_field(content, 'my_keymedia_field_identifier', {
format: [800, 600],
...
}) }}