Varien_Data_Form_Element_Abstract Class Reference

Inheritance diagram for Varien_Data_Form_Element_Abstract:

Varien_Data_Form_Abstract Varien_Object 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())
 addElement (Varien_Data_Form_Element_Abstract $element, $after=false)
 getId ()
 getType ()
 getForm ()
 setId ($id)
 getHtmlId ()
 getName ()
 setType ($type)
 setForm ($form)
 removeField ($elementId)
 getHtmlAttributes ()
 addClass ($class)
 getEscapedValue ($index=null)
 setRenderer (Varien_Data_Form_Element_Renderer_Interface $renderer)
 getRenderer ()
 getElementHtml ()
 getAfterElementHtml ()
 getLabelHtml ($idSuffix= '')
 getDefaultHtml ()
 getHtml ()
 toHtml ()
 serialize ($attributes=array(), $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 setReadonly ($readonly, $useDisabled=false)
 getReadonly ()

Protected Member Functions

 _escape ($string)

Protected Attributes

 $_id
 $_type
 $_form
 $_elements
 $_renderer


Detailed Description

Definition at line 35 of file Abstract.php.


Constructor & Destructor Documentation

__construct ( attributes = array()  ) 


Member Function Documentation

_escape ( string  )  [protected]

Definition at line 133 of file Abstract.php.

00134     {
00135         return htmlspecialchars($string, ENT_COMPAT);
00136     }

addClass ( class  ) 

Definition at line 126 of file Abstract.php.

00127     {
00128         $oldClass = $this->getClass();
00129         $this->setClass($oldClass.' '.$class);
00130         return $this;
00131     }

addElement ( Varien_Data_Form_Element_Abstract element,
after = false 
)

Add form element

Parameters:
Varien_Data_Form_Element_Abstract $element
Returns:
Varien_Data_Form

Reimplemented from Varien_Data_Form_Abstract.

Definition at line 55 of file Abstract.php.

00056     {
00057         if ($this->getForm()) {
00058             $this->getForm()->checkElementId($element->getId());
00059             $this->getForm()->addElementToCollection($element);
00060         }
00061 
00062         parent::addElement($element, $after);
00063         return $this;
00064     }

getAfterElementHtml (  ) 

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price, and Mage_Adminhtml_Block_System_Config_Form_Field_Select_Allowspecific.

Definition at line 167 of file Abstract.php.

00168     {
00169         return $this->getData('after_element_html');
00170     }

getDefaultHtml (  ) 

Reimplemented in Varien_Data_Form_Element_Fieldset, Varien_Data_Form_Element_Hidden, Varien_Data_Form_Element_Multiline, and Varien_Data_Form_Element_Multiselect.

Definition at line 184 of file Abstract.php.

00185     {
00186         $html = $this->getData('default_html');
00187         if (is_null($html)) {
00188             $html = ( $this->getNoSpan() === true ) ? '' : '<span class="field-row">'."\n";
00189             $html.= $this->getLabelHtml();
00190             $html.= $this->getElementHtml();
00191             $html.= ( $this->getNoSpan() === true ) ? '' : '</span>'."\n";
00192         }
00193         return $html;
00194     }

getElementHtml (  ) 

getEscapedValue ( index = null  ) 

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Price, and Varien_Data_Form_Element_Obscure.

Definition at line 138 of file Abstract.php.

00139     {
00140         $value = $this->getValue($index);
00141 
00142         if ($filter = $this->getValueFilter()) {
00143             $value = $filter->filter($value);
00144         }
00145         return $this->_escape($value);
00146     }

getForm (  ) 

Definition at line 76 of file Abstract.php.

00077     {
00078         return $this->_form;
00079     }

getHtml (  ) 

Reimplemented in Mage_Adminhtml_Block_System_Config_Form_Field_Select_Allowspecific, Varien_Data_Form_Element_Password, Varien_Data_Form_Element_Submit, and Varien_Data_Form_Element_Text.

Definition at line 196 of file Abstract.php.

00197     {
00198         if ($this->_renderer) {
00199             $html = $this->_renderer->render($this);
00200         }
00201         else {
00202             $html = $this->getDefaultHtml();
00203         }
00204         return $html;
00205     }

getHtmlAttributes (  ) 

Reimplemented in Varien_Data_Form_Element_Checkbox, Varien_Data_Form_Element_Checkboxes, Varien_Data_Form_Element_Multiline, Varien_Data_Form_Element_Multiselect, Varien_Data_Form_Element_Select, Varien_Data_Form_Element_Text, and Varien_Data_Form_Element_Textarea.

Definition at line 121 of file Abstract.php.

00122     {
00123         return array('type', 'title', 'class', 'style', 'onclick', 'onchange', 'disabled', 'readonly');
00124     }

getHtmlId (  ) 

Definition at line 88 of file Abstract.php.

00089     {
00090         return $this->getForm()->getHtmlIdPrefix() . $this->getData('html_id') . $this->getForm()->getHtmlIdSuffix();
00091     }

getId (  ) 

Retrieve object id

Returns:
mixed

Reimplemented from Varien_Object.

Definition at line 66 of file Abstract.php.

00067     {
00068         return $this->_id;
00069     }

getLabelHtml ( idSuffix = ''  ) 

Reimplemented in Varien_Data_Form_Element_Multiline.

Definition at line 172 of file Abstract.php.

00173     {
00174         if (!is_null($this->getLabel())) {
00175             $html = '<label for="'.$this->getHtmlId() . $idSuffix . '">'.$this->getLabel()
00176                 . ( $this->getRequired() ? ' <span class="required">*</span>' : '' ).'</label>'."\n";
00177         }
00178         else {
00179             $html = '';
00180         }
00181         return $html;
00182     }

getName (  ) 

Reimplemented in Varien_Data_Form_Element_Gallery, Varien_Data_Form_Element_Image, Varien_Data_Form_Element_Multiselect, and Varien_Data_Form_Element_Time.

Definition at line 93 of file Abstract.php.

00094     {
00095         $name = $this->getData('name');
00096         if ($suffix = $this->getForm()->getFieldNameSuffix()) {
00097             $name = $this->getForm()->addSuffixToName($name, $suffix);
00098         }
00099         return $name;
00100     }

getReadonly (  ) 

Definition at line 241 of file Abstract.php.

00242     {
00243         if ($this->hasData('readonly_disabled')) {
00244             return $this->_getData('readonly_disabled');
00245         }
00246 
00247         return $this->_getData('readonly');
00248     }

getRenderer (  ) 

Definition at line 154 of file Abstract.php.

00155     {
00156         return $this->_renderer;
00157     }

getType (  ) 

Definition at line 71 of file Abstract.php.

00072     {
00073         return $this->_type;
00074     }

removeField ( elementId  ) 

Enter description here...

Parameters:
string $elementId
Returns:
Varien_Data_Form_Abstract

Reimplemented from Varien_Data_Form_Abstract.

Definition at line 115 of file Abstract.php.

00116     {
00117         $this->getForm()->removeField($elementId);
00118         return parent::removeField($elementId);
00119     }

serialize ( attributes = array(),
valueSeparator = '=',
fieldSeparator = ' ',
quote = '"' 
)

serialize object attributes

Parameters:
array $attributes
string $valueSeparator
string $fieldSeparator
string $quote
Returns:
string

Reimplemented from Varien_Object.

Definition at line 212 of file Abstract.php.

00213     {
00214         if (in_array('disabled', $attributes) && !empty($this->_data['disabled'])) {
00215             $this->_data['disabled'] = 'disabled';
00216         }
00217         else {
00218             unset($this->_data['disabled']);
00219         }
00220         if (in_array('checked', $attributes) && !empty($this->_data['checked'])) {
00221             $this->_data['checked'] = 'checked';
00222         }
00223         else {
00224             unset($this->_data['checked']);
00225         }
00226         return parent::serialize($attributes, $valueSeparator, $fieldSeparator, $quote);
00227     }

setForm ( form  ) 

Definition at line 109 of file Abstract.php.

00110     {
00111         $this->_form = $form;
00112         return $this;
00113     }

setId ( value  ) 

Set object id field value

Parameters:
mixed $value
Returns:
Varien_Object

Reimplemented from Varien_Object.

Definition at line 81 of file Abstract.php.

00082     {
00083         $this->_id = $id;
00084         $this->setData('html_id', $id);
00085         return $this;
00086     }

setReadonly ( readonly,
useDisabled = false 
)

Definition at line 229 of file Abstract.php.

00230     {
00231         if ($useDisabled) {
00232             $this->setDisabled($readonly);
00233             $this->setData('readonly_disabled', $readonly);
00234         } else {
00235             $this->setData('readonly', $readonly);
00236         }
00237 
00238         return $this;
00239     }

setRenderer ( Varien_Data_Form_Element_Renderer_Interface renderer  ) 

Definition at line 148 of file Abstract.php.

00149     {
00150         $this->_renderer = $renderer;
00151         return $this;
00152     }

setType ( type  ) 

Definition at line 102 of file Abstract.php.

00103     {
00104         $this->_type = $type;
00105         $this->setData('type', $type);
00106         return $this;
00107     }

toHtml (  ) 

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery.

Definition at line 207 of file Abstract.php.

00208     {
00209         return $this->getHtml();
00210     }


Member Data Documentation

$_elements [protected]

Reimplemented from Varien_Data_Form_Abstract.

Definition at line 40 of file Abstract.php.

$_form [protected]

Definition at line 39 of file Abstract.php.

$_id [protected]

Definition at line 37 of file Abstract.php.

$_renderer [protected]

Definition at line 41 of file Abstract.php.

$_type [protected]

Definition at line 38 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