
Public Member Functions | |
| __construct ($attrs=array()) | |
| render ($name, $value, $extra_attrs=array()) | |
| valueFromFormData ($name, $data) | |
| idForLabel ($id) | |
Public Attributes | |
| $is_hidden = false | |
| $needs_multipart_form = false | |
| $input_type = '' | |
| $attrs = array() | |
Protected Member Functions | |
| buildAttrs ($attrs, $extra_attrs=array()) | |
| Pluf_Form_Widget::__construct | ( | $ | attrs = array() |
) |
| Pluf_Form_Widget::render | ( | $ | name, | |
| $ | value, | |||
| $ | extra_attrs = array() | |||
| ) |
Renders the HTML of the input.
| string | Name of the field. | |
| mixed | Value for the field, can be a non valid value. | |
| array | Extra attributes to add to the input form (array()) |
Reimplemented in Pluf_Form_Widget_CheckboxInput, Pluf_Form_Widget_DatetimeInput, Pluf_Form_Widget_FileInput, Pluf_Form_Widget_Input, Pluf_Form_Widget_PasswordInput, Pluf_Form_Widget_ReCaptcha, Pluf_Form_Widget_TextareaInput, and Pluf_Form_Widget_TinyMCEInput.
| Pluf_Form_Widget::buildAttrs | ( | $ | attrs, | |
| $ | extra_attrs = array() | |||
| ) | [protected] |
Build the list of attributes for the form. It should be called this way: $this->buildAttrs(array('name'=>$name, 'type'=>$this->input_type), $extra_attrs);
| array | Contains the name and type attributes. | |
| array | Extra attributes, like 'class' for example. |
| Pluf_Form_Widget::valueFromFormData | ( | $ | name, | |
| $ | data | |||
| ) |
A widget can split itself in multiple input form. For example you can have a datetime value in your model and you use 2 inputs one for the date and one for the time to input the value. So the widget must know how to get back the values from the submitted form.
| string | Name of the form. | |
| array | Submitted form data. |
Reimplemented in Pluf_Form_Widget_CheckboxInput, Pluf_Form_Widget_ReCaptcha, and Pluf_Form_Widget_SelectMultipleInput.
| Pluf_Form_Widget::idForLabel | ( | $ | id | ) |
Returns the HTML ID attribute of this Widget for use by a <label>, given the ID of the field. Returns None if no ID is available.
This hook is necessary because some widgets have multiple HTML elements and, thus, multiple IDs. In that case, this method should return an ID value that corresponds to the first ID in the widget's tags.
Reimplemented in Pluf_Form_Widget_SelectMultipleInput_Checkbox.
| Pluf_Form_Widget::$is_hidden = false |
Is an hidden field?
Reimplemented in Pluf_Form_Widget_HiddenInput.
| Pluf_Form_Widget::$needs_multipart_form = false |
Do we need multipart?
Reimplemented in Pluf_Form_Widget_FileInput.
| Pluf_Form_Widget::$input_type = '' |
Input type of the field.
Reimplemented in Pluf_Form_Widget_CheckboxInput, Pluf_Form_Widget_DatetimeInput, Pluf_Form_Widget_FileInput, Pluf_Form_Widget_HiddenInput, Pluf_Form_Widget_PasswordInput, Pluf_Form_Widget_ReCaptcha, and Pluf_Form_Widget_TextInput.
| Pluf_Form_Widget::$attrs = array() |
HTML attributes for the widget.