![]() |
|
mpStarRatingPlugin - 1.0.0Use Stars in your rating forms. |
|
The mpWidgetFormChoiceRatingPlugin is a widget created to show radio butons of rating like stars.
This collection starts with only a widget and have external dependencies of jquery.
Install the plugin
$ symfony plugin:install mpWidgetFormChoiceRatingPlugin
Clear the cache
$ symfony cache:clear
$ symfony plugin:publish-assets
Use the widget overriting your form widget generated by doctrine or your custom form
$options = array(0 => 'Não sei', 1 => 'Péssimo', 2 => 'Aceitável', 3 => 'Mediano', 4 => 'Muito bom', 5 => 'Excelente');
$widgets = $this->getWidgetSchema();
$widgets['rating_comfort'] = new mpWidgetFormChoiceRating( array('choices' => $options ) );
$widgets['rating_room'] = new mpWidgetFormChoiceRating( array('choices' => $options ) );
$widgets['rating_service'] = new mpWidgetFormChoiceRating( array('choices' => $options ) );
make sure you already have the jquery js in the page, so download the ui files from jquery website and put in web/jquery/jquery.ui/ui/ui.core.js web/jquery/jquery.ui/ui/jquery.ui.widget.js
that's all folks.
All classes have full API and usage documentation. The best way to learn each widget or validator is to read the API.
As no third party libraries is bundled in the plugin, you need to install and load the required dependencies like JQuery and JQuery UI.
It's based on Star Rating widget ( http://plugins.jquery.com/project/Star_Rating_widget )