- eZ Platform 2.0+
- eZ Publish Legacy Stack with legacy eZ Tags 2.1 installed and configured, to enable editing
eztags
attributes in legacy admin interface
Run the following from your website root folder to install Netgen Tags Bundle:
$ composer require netgen/tagsbundle
Activate the bundle in app/AppKernel.php
file by adding it to the $bundles
array in registerBundles
method, together with other required bundles:
public function registerBundles()
{
...
$bundles[] = new Lolautruche\EzCoreExtraBundle\EzCoreExtraBundle();
$bundles[] = new Netgen\TagsBundle\NetgenTagsBundle();
return $bundles;
}
Put the following in your app/config/routing.yml
file to be able to display tag view pages:
netgen_tags:
resource: "@NetgenTagsBundle/Resources/config/routing.yml"
Add the bundle to Assetic configuration in app/config/config.yml
, together with EzPlatformAdminUiBundle
and all other bundles already configured there:
assetic:
bundles: [EzPlatformAdminUiBundle, NetgenTagsBundle]
Netgen Tags Bundle uses custom database tables to store the tags. Use the following command to add the tables to your eZ Platform database:
$ mysql -u<user> -p<password> -h<host> <db_name> < vendor/netgen/tagsbundle/bundle/Resources/sql/mysql/schema.sql
PostgreSQL variant of the above schema file is also available at vendor/netgen/tagsbundle/bundle/Resources/sql/postgresql/schema.sql
Give 'Read' permisions to the 'Tags' module for the Anonymous Role.
Clear the eZ Platform caches with the following command:
$ php bin/console cache:clear
Run the following to correctly install and dump assets for admin UI. Make sure to use the correct Symfony environment with --env
parameter:
$ php bin/console assets:install --symlink --relative
$ php bin/console assetic:dump
Add the following block to the end of if (req.method == "BAN")
block in ez_purge
method in your Varnish configuration file to be able to clear Varnish cache for tag view pages:
if ( req.http.X-Tag-Id == "*" ) {
# Ban all tags
ban( "obj.http.X-Tag-Id ~ ^[0-9]+$" );
if (client.ip ~ debuggers) {
set req.http.X-Debug = "Ban done for all tags";
}
return (synth(200, "Banned"));
} elseif ( req.http.X-Tag-Id ) {
# Ban tag by its ID
ban( "obj.http.X-Tag-Id == " + req.http.X-Tag-Id );
if (client.ip ~ debuggers) {
set req.http.X-Debug = "Ban done for tag with ID " + req.http.X-Tag-Id;
}
return (synth(200, "Banned"));
}
After you restart Varnish, you will be able to clear the caches for a specific tag with the following example shell command:
$ curl -v -X BAN -H "X-Tag-Id: 1" http://varnish.local:81/
This will clear Varnish cache for tag view pages for tag with ID of 1.
-
You can now load and create content with
eztags
field type -
Use
TagsService
in your controllers to work with tags. The service is accessible through Symfony2 DIC, with IDeztags.api.service.tags