Perforce Chronicle 2012.2/486814
API Documentation
|
This is the widget configuration form. More...
Public Member Functions | |
init () | |
Defines the elements that make up the widget config form. |
This is the widget configuration form.
Widget_Form_Config::init | ( | ) |
Defines the elements that make up the widget config form.
Called automatically when the form object is created.
{ $this->setMethod('post'); $this->setAttrib('class', 'p4cms-ui multi-part widget-config'); // add hidden region/widget id fields. $this->addElement('hidden', 'region'); $this->addElement('hidden', 'widget'); // add a field for the widget name. $this->addElement( 'text', 'title', array( 'label' => 'Title', 'required' => true ) ); // add a field for the widget name. $this->addElement( 'checkbox', 'showTitle', array( 'label' => 'Show Title' ) ); // add a field to change the weight of the widget. $this->addElement( 'select', 'order', array( 'label' => 'Order', 'value' => 0, 'description' => "Adjust the position of this widget in the region.", 'multiOptions' => array_combine(range(-10, 10), range(-10, 10)) ) ); // add a field to allow users to specify a CSS class. $this->addElement( 'text', 'class', array( 'label' => 'CSS Class', 'description' => "Specify a CSS class to customize the appearance of this widget.", 'filters' => array('StringTrim'), 'validators' => array('CssClass') ) ); // add a field to load the widget out-of-band (asynchronously). $this->addElement( 'checkbox', 'asynchronous', array( 'label' => 'Load Asynchronously', 'description' => "Load this widget after the rest of the page.", 'checked' => false ) ); // put the general options in a fieldset. $this->addDisplayGroup( array('title', 'showTitle', 'order', 'class', 'asynchronous'), 'general', array('legend' => 'General Options', 'order' => 1) ); // add cancel/save buttons. $this->addElement( 'Button', 'cancel', array( 'label' => 'Cancel', 'ignore' => true ) ); $this->addElement( 'SubmitButton', 'save', array( 'label' => 'Save', 'class' => 'preferred', 'ignore' => true ) ); // put the buttons in a fieldset. $this->addDisplayGroup( array('save', 'cancel'), 'buttons', array('class' => 'buttons', 'order' => 100) ); }