Europa Component Library Twig loader
, (*1)
Twig loader for Europa Component Library Twig implementation (ECL Twig),
it allows to load components by accessing them via a configurable namespace., (*2)
For example, given you have the following ECL twig components:, (*3)
/path/to/components/
โโโ ec-component-link
โย ย โโโ ecl-link.html.twig
โโโ ec-component-language-list
ย ย โโโ ecl-language-list.html.twig
ย ย โโโ ecl-language-list-item.html.twig
ย ย โโโ ecl-language-list-overlay.html.twig
ย ย โโโ ecl-language-list-splash.html.twig
If you setup the loader as follows:, (*4)
<?php
use \OpenEuropa\Twig\Loader\EuropaComponentLibraryLoader;
$loader = new EuropaComponentLibraryLoader(['ecl-twig'], '/components', '/path/to');
$twig = new Twig_Environment($loader);
Then you can load the link component in the following way:, (*5)
{% include '@ecl-twig/ec-component-link/ecl-link.html.twig' with {
link: {
type: 'standalone',
label: 'Standalone link',
path: 'http://google.com',
icon_position: 'after'
}
} %}
You can also use a shorter form, based on implicit naming conventions:, (*6)
{% include '@ecl-twig/link' with {
link: {
type: 'standalone',
label: 'Standalone link',
path: 'http://google.com',
icon_position: 'after'
}
} %}
To load sub-components append them after the component name:, (*7)
{% include '@ecl-twig/language-list/language-list-splash' %}
Installation using Docker Compose
The setup procedure can be simplified by using Docker Compose., (*8)
Requirements:, (*9)
Copy docker-compose.yml.dist into docker-compose.yml., (*10)
You can make any alterations you need for your local Docker setup. However, the defaults should be enough to set the project up., (*11)
Run:, (*12)
$ docker-compose up -d
Then:, (*13)
$ docker-compose exec web composer install