Public Member Functions | |
__construct ($attributes=array()) | |
addElement (Varien_Data_Form_Element_Abstract $element, $after=false) | |
addElementToCollection ($element) | |
checkElementId ($elementId) | |
getForm () | |
getElement ($elementId) | |
setValues ($values) | |
addValues ($values) | |
addFieldNameSuffix ($suffix) | |
addSuffixToName ($name, $suffix) | |
removeField ($elementId) | |
toHtml () | |
getHtml () | |
Static Public Member Functions | |
static | setElementRenderer (Varien_Data_Form_Element_Renderer_Interface $renderer) |
static | setFieldsetRenderer (Varien_Data_Form_Element_Renderer_Interface $renderer) |
static | setFieldsetElementRenderer (Varien_Data_Form_Element_Renderer_Interface $renderer) |
static | getElementRenderer () |
static | getFieldsetRenderer () |
static | getFieldsetElementRenderer () |
Protected Member Functions | |
_elementIdExists ($elementId) | |
Protected Attributes | |
$_allElements | |
$_elementsIndex | |
Static Protected Attributes | |
static | $_defaultElementRenderer |
static | $_defaultFieldsetRenderer |
static | $_defaultFieldsetElementRenderer |
Definition at line 34 of file Form.php.
__construct | ( | $ | attributes = array() |
) |
Enter description here...
array | $attributes |
Reimplemented from Varien_Data_Form_Abstract.
Definition at line 54 of file Form.php.
00055 { 00056 parent::__construct($attributes); 00057 $this->_allElements = new Varien_Data_Form_Element_Collection($this); 00058 }
_elementIdExists | ( | $ | elementId | ) | [protected] |
addElement | ( | Varien_Data_Form_Element_Abstract $ | element, | |
$ | after = false | |||
) |
Add form element
Varien_Data_Form_Element_Abstract | $element |
Reimplemented from Varien_Data_Form_Abstract.
Definition at line 96 of file Form.php.
00097 { 00098 $this->checkElementId($element->getId()); 00099 parent::addElement($element, $after); 00100 $this->addElementToCollection($element); 00101 return $this; 00102 }
addElementToCollection | ( | $ | element | ) |
addFieldNameSuffix | ( | $ | suffix | ) |
Definition at line 169 of file Form.php.
00170 { 00171 foreach ($this->_allElements as $element) { 00172 $name = $element->getName(); 00173 if ($name) { 00174 $element->setName($this->addSuffixToName($name, $suffix)); 00175 } 00176 } 00177 }
addSuffixToName | ( | $ | name, | |
$ | suffix | |||
) |
addValues | ( | $ | values | ) |
Definition at line 156 of file Form.php.
00157 { 00158 if (!is_array($values)) { 00159 return $this; 00160 } 00161 foreach ($values as $elementId=>$value) { 00162 if ($element = $this->getElement($elementId)) { 00163 $element->setValue($value); 00164 } 00165 } 00166 return $this; 00167 }
checkElementId | ( | $ | elementId | ) |
Definition at line 122 of file Form.php.
00123 { 00124 if ($this->_elementIdExists($elementId)) { 00125 throw new Exception('Element with id "'.$elementId.'" already exists'); 00126 } 00127 return true; 00128 }
getElement | ( | $ | elementId | ) |
Definition at line 135 of file Form.php.
00136 { 00137 if ($this->_elementIdExists($elementId)) { 00138 return $this->_elementsIndex[$elementId]; 00139 } 00140 return null; 00141 }
static getElementRenderer | ( | ) | [static] |
static getFieldsetElementRenderer | ( | ) | [static] |
static getFieldsetRenderer | ( | ) | [static] |
removeField | ( | $ | elementId | ) |
Enter description here...
string | $elementId |
Reimplemented from Varien_Data_Form_Abstract.
Definition at line 192 of file Form.php.
00193 { 00194 if ($this->_elementIdExists($elementId)) { 00195 unset($this->_elementsIndex[$elementId]); 00196 } 00197 return $this; 00198 }
static setElementRenderer | ( | Varien_Data_Form_Element_Renderer_Interface $ | renderer | ) | [static] |
static setFieldsetElementRenderer | ( | Varien_Data_Form_Element_Renderer_Interface $ | renderer | ) | [static] |
static setFieldsetRenderer | ( | Varien_Data_Form_Element_Renderer_Interface $ | renderer | ) | [static] |
setValues | ( | $ | values | ) |
toHtml | ( | ) |
Definition at line 200 of file Form.php.
00201 { 00202 Varien_Profiler::start('form/toHtml'); 00203 $html = ''; 00204 if ($useContainer = $this->getUseContainer()) { 00205 $html .= '<form '.$this->serialize(array('id', 'name', 'method', 'action', 'enctype', 'class', 'onsubmit')).'>'; 00206 $html .= '<div>'; 00207 if (strtolower($this->getData('method')) == 'post') { 00208 $html .= '<input name="form_key" type="hidden" value="'.Mage::getSingleton('core/session')->getFormKey().'" />'; 00209 } 00210 $html .= '</div>'; 00211 } 00212 00213 foreach ($this->getElements() as $element) { 00214 $html.= $element->toHtml(); 00215 } 00216 00217 if ($useContainer) { 00218 $html.= '</form>'; 00219 } 00220 Varien_Profiler::stop('form/toHtml'); 00221 return $html; 00222 }