Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract Class Reference

Inheritance diagram for Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract:

Mage_Adminhtml_Block_System_Config_Form_Field Mage_Adminhtml_Block_Abstract Varien_Data_Form_Element_Renderer_Interface Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_System_Config_Form_Field_Regexceptions

List of all members.

Public Member Functions

 __construct ()
 addColumn ($name, $params)

Protected Member Functions

 _getElementHtml (Varien_Data_Form_Element_Abstract $element)
 _renderCellTemplate ($columnName)

Protected Attributes

 $_columns = array()
 $_addAfter = true
 $_addButtonLabel


Detailed Description

Definition at line 34 of file Abstract.php.


Constructor & Destructor Documentation

__construct (  ) 

Check if columns are defined, set template

Reimplemented from Varien_Object.

Reimplemented in Mage_Adminhtml_Block_System_Config_Form_Field_Regexceptions.

Definition at line 63 of file Abstract.php.

00064     {
00065         if (empty($this->_columns)) {
00066             throw new Exception('At least one column must be defined.');
00067         }
00068         if (!$this->_addButtonLabel) {
00069             $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add');
00070         }
00071         parent::__construct();
00072         if (!$this->getTemplate()) {
00073             $this->setTemplate('system/config/form/field/array.phtml');
00074         }
00075     }


Member Function Documentation

_getElementHtml ( Varien_Data_Form_Element_Abstract element  )  [protected]

Get the grid and scripts contents

Parameters:
Varien_Data_Form_Element_Abstract $element
Returns:
string

Reimplemented from Mage_Adminhtml_Block_System_Config_Form_Field.

Definition at line 103 of file Abstract.php.

00104     {
00105         $this->setElement($element);
00106         $html = $this->_toHtml();
00107         $this->_arrayRowsCache = null; // doh, the object is used as singleton!
00108         return $html;
00109     }

_renderCellTemplate ( columnName  )  [protected]

Render array cell for prototypeJS template

Parameters:
string $columnName
Returns:
string

Definition at line 145 of file Abstract.php.

00146     {
00147         if (empty($this->_columns[$columnName])) {
00148             throw new Exception('Wrong column name specified.');
00149         }
00150         $column     = $this->_columns[$columnName];
00151         $inputName  = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
00152 
00153         if ($column['renderer']) {
00154             return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
00155                 ->toHtml();
00156         }
00157 
00158         return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}" ' .
00159             ($column['size'] ? 'size="' . $column['size'] . '"' : '') . ' class="' .
00160             (isset($column['class']) ? $column['class'] : 'input-text') . '"'.
00161             (isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '/>';
00162     }

addColumn ( name,
params 
)

Add a column to array-grid

Parameters:
string $name
array $params

Definition at line 83 of file Abstract.php.

00084     {
00085         $this->_columns[$name] = array(
00086             'label'     => empty($params['label']) ? 'Column' : $params['label'],
00087             'size'      => empty($params['size'])  ? false    : $params['size'],
00088             'style'     => empty($params['style'])  ? null    : $params['style'],
00089             'class'     => empty($params['class'])  ? null    : $params['class'],
00090             'renderer'  => false,
00091         );
00092         if ((!empty($params['renderer'])) && ($params['renderer'] instanceof Mage_Core_Block_Abstract)) {
00093             $this->_columns[$name]['renderer'] = $params['renderer'];
00094         }
00095     }


Member Data Documentation

$_addAfter = true [protected]

Definition at line 48 of file Abstract.php.

$_addButtonLabel [protected]

Definition at line 55 of file Abstract.php.

$_columns = array() [protected]

Definition at line 41 of file Abstract.php.


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

Generated on Sat Jul 4 17:23:03 2009 for Magento by  doxygen 1.5.8