centurion-project/Centurion — pull request #33 by frenchcomp (2012-02-14 14:52:23+00:00)
Title: Decorator for elements supporting mutlselect order

New decorator for multiselect form elements to support ordering.

Centurion provides a mechanism to save the order in relation, and return it in front, but no provide element in form to allow user to order elements. This patch provides a new decorator for multiselect to allow this :

To use the multiselect with ordering
====================================

* Add a trait on your form to support decorator provided by Core

class myForm
extends Centurion_Form_Model_Abstract
implements Core_Traits_Decorators_Form_Model_Interface

* overload the method `render` and add these lines before calls to method `render` of parent :
(because Centurion_Form_Model reset elements decorators).

$this->getElement('myManyToManyRelation')->setDecorators(array(
array('Multiselect' => 'MultiselectOrder')
)
);

@Todo : add a system allows developer to defines new paths in Decorator PluginLoader in the configuration, and remove the trait Core_Traits_Decorators_Form_Model_Interface