Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes:

Mage_Adminhtml_Block_Catalog_Form Mage_Adminhtml_Block_Widget_Form Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getCategory ()
 __construct ()

Protected Member Functions

 _prepareForm ()
 _getAdditionalElementTypes ()


Detailed Description

Definition at line 35 of file Attributes.php.


Constructor & Destructor Documentation

__construct (  ) 

Initialize tab

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 51 of file Attributes.php.

00051                                   {
00052         parent::__construct();
00053         $this->setShowGlobalIcon(true);
00054     }


Member Function Documentation

_getAdditionalElementTypes (  )  [protected]

Retrieve Additional Element Types

Returns:
array

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 137 of file Attributes.php.

00138     {
00139         return array(
00140             'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_category_helper_image')
00141         );
00142     }

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 61 of file Attributes.php.

00061                                       {
00062         $group      = $this->getGroup();
00063         $attributes = $this->getAttributes();
00064 
00065         $form = new Varien_Data_Form();
00066         $form->setHtmlIdPrefix('group_' . $group->getId());
00067         $form->setDataObject($this->getCategory());
00068 
00069         $fieldset = $form->addFieldset('fieldset_group_' . $group->getId(), array(
00070             'legend'    => Mage::helper('catalog')->__($group->getAttributeGroupName())
00071         ));
00072 
00073         if ($this->getAddHiddenFields()) {
00074             if (!$this->getCategory()->getId()) {
00075                 // path
00076                 if ($this->getRequest()->getParam('parent')) {
00077                     $fieldset->addField('path', 'hidden', array(
00078                         'name'  => 'path',
00079                         'value' => $this->getRequest()->getParam('parent')
00080                     ));
00081                 }
00082                 else {
00083                     $fieldset->addField('path', 'hidden', array(
00084                         'name'  => 'path',
00085                         'value' => 1
00086                     ));
00087                 }
00088             }
00089             else {
00090                 $fieldset->addField('id', 'hidden', array(
00091                     'name'  => 'id',
00092                     'value' => $this->getCategory()->getId()
00093                 ));
00094                 $fieldset->addField('path', 'hidden', array(
00095                     'name'  => 'path',
00096                     'value' => $this->getCategory()->getPath()
00097                 ));
00098             }
00099         }
00100 
00101         $this->_setFieldset($attributes, $fieldset);
00102 
00103         foreach ($attributes as $attribute) {
00104             /* @var $attribute Mage_Eav_Model_Entity_Attribute */
00105             if ($attribute->getAttributeCode() == 'url_key') {
00106                 if ($this->getCategory()->getLevel() == 1) {
00107                     $fieldset->removeField('url_key');
00108                     $fieldset->addField('url_key', 'hidden', array(
00109                         'name'  => 'url_key',
00110                         'value' => $this->getCategory()->getUrlKey()
00111                     ));
00112                 }
00113             }
00114         }
00115 
00116         if ($this->getCategory()->hasLockedAttributes()) {
00117             foreach ($this->getCategory()->getLockedAttributes() as $attribute) {
00118                 if ($element = $form->getElement($attribute)) {
00119                     $element->setReadonly(true, true);
00120                 }
00121             }
00122         }
00123 
00124         $form->addValues($this->getCategory()->getData());
00125 
00126         $form->setFieldNameSuffix('general');
00127         $this->setForm($form);
00128 
00129         return parent::_prepareForm();
00130     }

getCategory (  ) 

Retrieve Category object

Returns:
Mage_Catalog_Model_Category

Definition at line 42 of file Attributes.php.

00043     {
00044         return Mage::registry('current_category');
00045     }


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

Generated on Sat Jul 4 17:22:42 2009 for Magento by  doxygen 1.5.8