anh/taggable-bundle

Taggable symfony bundle

Maintainers

👁 hilobok

Package info

github.com/hilobok/AnhTaggableBundle

Type:symfony-bundle

pkg:composer/anh/taggable-bundle

Statistics

Installs: 12 622

Dependents: 2

Suggesters: 0

Stars: 6

Open Issues: 3

v1.2.1 2014-07-18 13:54 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ac66effa68deae2f4bc692e692cb29a281d86101

  • Andrew Hilobok <hilobok.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-06 12:51:12 UTC


README

Bundle provides integration of doctrine-extensions-taggable, adds form types for editing tag and tagging.

Installation

Install via composer with command:

$ php composer.phar require 'anh/taggable-bundle:~1.0'

Enable bundles in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
 $bundles = array(
 // ...
 new Sp\BowerBundle\SpBowerBundle(),
 new Anh\TaggableBundle\AnhTaggableBundle()
 );

 // ...
}

Install dependencies:

$ app/console sp:bower:install

Bundle uses SpBowerBundle for manage external assets, so installed bower is required.

Update schema:

$ app/console doctrine:schema:update --force

Example

Building form

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
 // ...
 $builder
 ->add('tags', 'tags', array(
 'tagit' => array(/* ... */), // see https://github.com/hilobok/tag-it for available options, may be empty
 'autocomplete' => 'dynamic' // default
 ))
 ;
 // ...
 }

autocomplete option:

  • dynamic - tags fetched dynamically via ajax (you may set custom url in ['tagit']['autocomplete']['source']) (limited to 100 tags)
  • static - all tags passed via attribute (limited to 100 tags)
  • custom - no tags will be provided from db (custom list of tags may be passed by setting ['tagit']['availableTags'])

Rendering form

<!doctype html>
<html>
<head>
 <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
 {% stylesheets
 '@anh_taggable_css'
 %}<link rel="stylesheet" href="{{ asset_url }}" />{% endstylesheets %}

 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
 <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
 {% javascripts
 '@anh_taggable_js'
 %}<script src="{{ asset_url }}"></script>{% endjavascripts %}
</head>
<body>
 {{ form(form) }}
</body>
</html>

👁 Example

Note

Bundle automatically adds mapping for Tag and Tagging entities from doctrine-extensions-taggable. If you for any reason have to disable it put in config.yml:

doctrine:
 orm:
 mappings:
 anh_taggable: { mapping: false }