syzygypl / kunstmaan-tag-group-bundle
Installs: 12 490
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- kunstmaan/tagging-bundle: ~3.0
Requires (Dev)
- friendsofsymfony/user-bundle: 2.0.*@dev
This package is not auto-updated.
Last update: 2024-11-09 19:36:09 UTC
README
KunstmaanTagGroupBundle enables you to organize tags in groups and easy filter tags by group and taggable entity.
Instalation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require syzygypl/kunstmaan-tag-group-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Szg\KunstmaanTagGroupBundle\KunstmaanTagGroupBundle(), ); // ... } // ... }
Install assets
app/console assets:install
Update database schema
app/console doctrine:schema:update
Add routes in app/config/routing.yml
:
KunstmaanTagGroupBundle:
resource: "@KunstmaanTagGroupBundle/Resources/config/routing.yml"
Usage
- Go to admin panel
Modules/Tags Groups
- Create group with name and unique
internalName
- Add tags to groups
- Get filtered taggable object tags from group by internalName:
{% set tags = page|tag_group('internalName') %} {% if tags|length %} <ul> {% for tag in tags %} <li>{{ tag.name }}</li> {% endfor %} </ul> {% endif %}
or use the public service:
<?php $tagGroupService = $this->get('szg_kunstmaantaggroupbundle.tag_group.manager'); $group = $tagGroupService->getGroupByName('internalName'); $tags = $tagGroupService->filterByGroup($taggable, $group)