Pluf_Form_Widget Class Reference

Inheritance diagram for Pluf_Form_Widget:

Pluf_Form_Widget_Input Pluf_Form_Widget_SelectInput Pluf_Form_Widget_SelectMultipleInput Pluf_Form_Widget_TextareaInput Pluf_Form_Widget_TinyMCEInput Pluf_Form_Widget_CheckboxInput Pluf_Form_Widget_DatetimeInput Pluf_Form_Widget_FileInput Pluf_Form_Widget_HiddenInput Pluf_Form_Widget_PasswordInput Pluf_Form_Widget_ReCaptcha Pluf_Form_Widget_TextInput Pluf_Form_Widget_SelectMultipleInput_Checkbox

List of all members.

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())


Detailed Description

Base class to display a form field.

Constructor & Destructor Documentation

Pluf_Form_Widget::__construct ( attrs = array()  ) 


Member Function Documentation

Pluf_Form_Widget::render ( name,
value,
extra_attrs = array() 
)

Renders the HTML of the input.

Parameters:
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())
Returns:
string The HTML string of the input.

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);

Parameters:
array Contains the name and type attributes.
array Extra attributes, like 'class' for example.
Returns:
array The attributes for the field.

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.

Parameters:
string Name of the form.
array Submitted form data.
Returns:
mixed Value or null if not defined.

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.


Member Data Documentation

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 = ''

Pluf_Form_Widget::$attrs = array()

HTML attributes for the widget.


The documentation for this class was generated from the following file:

Generated on Wed Feb 3 15:44:52 2010 for Pluf by  doxygen