sfPropelTaggableWidgetPlugin - 0.0.8

A widget and a validator for nice tagging

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Dependencies Releases Changelog Contribute
Show source

sfPropelTaggableWidgetPlugin

If you have sfPropelActAsTaggableBehaviorPlugin installed you will get a widget (and a validator) with rich user interface, with autocomplete and keyboard interaction. ss1.png

Introduction

This plugins depends on sfPropelActAsTaggableBehaviorPlugin and jQuery You will be able to add a nice tag selection tool to your forms.

Features

  • user-friendly tag insertion with mouse and keyboard interaction
  • tags added and removed by check/uncheck on checkboxes
  • tag client-side, save server-side
  • easy label customization
  • widget and validator class

Get it installed

  • be sure to have sfPropelActAsTaggableBehaviorPlugin installed and enabled

  • be sure to enable jQuery

  • go to your project's root

  • Install the plugin:

     ./symfony plugin:install sfPropelTaggableWidgetPlugin
    
  • clear your cache:

     ./symfony cc
    

Usage

Enable the widget in your form class

class PostForm extends BasePostForm {
  public function configure()
  {
    $this->setWidget('tags', new sfWidgetFormInputTags(array(
      'taggable_object'          => $this->getObject(),
      'enable_autocomplete'      => true
    )));
  }
}

Set the validator

class PostForm extends BasePostForm {
  public function configure()
  {
    $this->setWidget('tags', new sfWidgetFormInputTags(array(
      'taggable_object'          => $this->getObject(),
      'enable_autocomplete'      => true
    )));
 
    $this->setValidator('tags', new sfValidatorTags());
  }
}

and you're done.

Parameters

required parameters

  • taggable_object: is the only required option for the widget. It must be a Propel object with the sfPropelActAsTaggable behavior

optional parameters

  • enable_autocomplete: enables the autocomplete on the text input. The data are taken from the TagPeer::getAll() method. (default: TRUE)
  • check_all_label: the label for the "check all tags" button. (default: Check all)
  • uncheck_all_label: the label for the "uncheck all tags" button. (default: Uncheck all)
  • invert_selection_label: the label for the "invert tags selection" button. (default: Invert selection)

License and credits

This plugin has been developed by matteosister and is licensed under the MIT license.