Varien_Data_Form_Abstract Class Reference

Inheritance diagram for Varien_Data_Form_Abstract:

Varien_Object Varien_Data_Form Varien_Data_Form_Element_Abstract Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery Mage_Adminhtml_Block_System_Config_Form_Field_Export Mage_Adminhtml_Block_System_Config_Form_Field_Import Mage_Weee_Block_Element_Weee_Tax Varien_Data_Form_Element_Button Varien_Data_Form_Element_Checkbox Varien_Data_Form_Element_Checkboxes Varien_Data_Form_Element_Column Varien_Data_Form_Element_Date Varien_Data_Form_Element_Fieldset Varien_Data_Form_Element_File Varien_Data_Form_Element_Gallery Varien_Data_Form_Element_Hidden Varien_Data_Form_Element_Image Varien_Data_Form_Element_Imagefile Varien_Data_Form_Element_Label Varien_Data_Form_Element_Multiline Varien_Data_Form_Element_Multiselect Varien_Data_Form_Element_Note Varien_Data_Form_Element_Password Varien_Data_Form_Element_Radio Varien_Data_Form_Element_Radios Varien_Data_Form_Element_Reset Varien_Data_Form_Element_Select Varien_Data_Form_Element_Submit Varien_Data_Form_Element_Text Varien_Data_Form_Element_Textarea Varien_Data_Form_Element_Time

List of all members.

Public Member Functions

 __construct ($attributes=array())
 addType ($type, $className)
 getElements ()
 addElement (Varien_Data_Form_Element_Abstract $element, $after=null)
 addField ($elementId, $type, $config, $after=false)
 removeField ($elementId)
 addFieldset ($elementId, $config, $after=false)
 addColumn ($elementId, $config)
 __toArray (array $arrAttributes=array())

Protected Attributes

 $_elements
 $_types = array()


Detailed Description

Definition at line 35 of file Abstract.php.


Constructor & Destructor Documentation

__construct ( attributes = array()  ) 


Member Function Documentation

__toArray ( array arrAttributes = array()  ) 

Enter description here...

Parameters:
array $arrAttributes
Returns:
array

Reimplemented from Varien_Object.

Definition at line 181 of file Abstract.php.

00182     {
00183         $res = array();
00184         $res['config']  = $this->getData();
00185         $res['formElements']= array();
00186         foreach ($this->getElements() as $element) {
00187             $res['formElements'][] = $element->toArray();
00188         }
00189         return $res;
00190     }

addColumn ( elementId,
config 
)

Enter description here...

Parameters:
string $elementId
array $config
Returns:
Varien_Data_Form_Element_Column

Definition at line 166 of file Abstract.php.

00167     {
00168         $element = new Varien_Data_Form_Element_Column($config);
00169         $element->setForm($this)
00170             ->setId($elementId);
00171         $this->addElement($element);
00172         return $element;
00173     }

addElement ( Varien_Data_Form_Element_Abstract element,
after = null 
)

Add form element

Parameters:
Varien_Data_Form_Element_Abstract $element
Returns:
Varien_Data_Form

Reimplemented in Varien_Data_Form_Element_Abstract, and Varien_Data_Form.

Definition at line 94 of file Abstract.php.

00095     {
00096         $element->setForm($this);
00097         $this->getElements()->add($element, $after);
00098         return $this;
00099     }

addField ( elementId,
type,
config,
after = false 
)

Add child element

if $after parameter is false - then element adds to end of collection if $after parameter is null - then element adds to befin of collection if $after parameter is string - then element adds after of the element with some id

Parameters:
string $elementId
string $type
array $config
mixed $after
Returns:
Varien_Data_Form_Element_Abstract

Reimplemented in Varien_Data_Form_Element_Fieldset.

Definition at line 114 of file Abstract.php.

00115     {
00116         if (isset($this->_types[$type])) {
00117             $className = $this->_types[$type];
00118         }
00119         else {
00120             $className = 'Varien_Data_Form_Element_'.ucfirst(strtolower($type));
00121         }
00122         $element = new $className($config);
00123         $element->setId($elementId);
00124         if ($element->getRequired()) {
00125             $element->addClass('required-entry');
00126         }
00127         $this->addElement($element, $after);
00128         return $element;
00129     }

addFieldset ( elementId,
config,
after = false 
)

Enter description here...

Parameters:
string $elementId
unknown_type $config
unknown_type $after
Returns:
Varien_Data_Form_Element_Fieldset

Definition at line 151 of file Abstract.php.

00152     {
00153         $element = new Varien_Data_Form_Element_Fieldset($config);
00154         $element->setId($elementId);
00155         $this->addElement($element, $after);
00156         return $element;
00157     }

addType ( type,
className 
)

Enter description here...

Parameters:
string $type
string $className
Returns:
Varien_Data_Form_Abstract

Definition at line 69 of file Abstract.php.

00070     {
00071         $this->_types[$type] = $className;
00072         return $this;
00073     }

getElements (  ) 

Enter description here...

Returns:
Varien_Data_Form_Element_Collection

Definition at line 80 of file Abstract.php.

00081     {
00082         if (empty($this->_elements)) {
00083             $this->_elements = new Varien_Data_Form_Element_Collection($this);
00084         }
00085         return $this->_elements;
00086     }

removeField ( elementId  ) 

Enter description here...

Parameters:
string $elementId
Returns:
Varien_Data_Form_Abstract

Reimplemented in Varien_Data_Form_Element_Abstract, and Varien_Data_Form.

Definition at line 137 of file Abstract.php.

00138     {
00139         $this->getElements()->remove($elementId);
00140         return $this;
00141     }


Member Data Documentation

$_elements [protected]

Reimplemented in Varien_Data_Form_Element_Abstract.

Definition at line 43 of file Abstract.php.

$_types = array() [protected]

Definition at line 50 of file Abstract.php.


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

Generated on Sat Jul 4 17:24:59 2009 for Magento by  doxygen 1.5.8