Mage_Adminhtml_Block_Widget_Form Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Widget_Form:

Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_Api_Tab_Roleinfo Mage_Adminhtml_Block_Api_Tab_Rolesedit Mage_Adminhtml_Block_Api_User_Edit_Form Mage_Adminhtml_Block_Api_User_Edit_Tab_Main Mage_Adminhtml_Block_Catalog_Form Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Form Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Front Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_System Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formattribute Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formgroup Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formset Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Toolbar_Main_Filter Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Settings Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Settings Mage_Adminhtml_Block_Catalog_Search_Edit_Form Mage_Adminhtml_Block_Checkout_Agreement_Edit_Form Mage_Adminhtml_Block_Cms_Block_Edit_Form Mage_Adminhtml_Block_Cms_Page_Edit_Form Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Design Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Main Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Meta Mage_Adminhtml_Block_Customer_Edit_Form Mage_Adminhtml_Block_Customer_Edit_Tab_Account Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter Mage_Adminhtml_Block_Customer_Group_Edit_Form Mage_Adminhtml_Block_Customer_Online_Filter Mage_Adminhtml_Block_Extensions_Config_Form Mage_Adminhtml_Block_Extensions_Console_Edit_Form Mage_Adminhtml_Block_Extensions_Custom_Edit_Form Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Abstract Mage_Adminhtml_Block_Extensions_File_Form Mage_Adminhtml_Block_Extensions_Local_Edit_Form Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Abstract Mage_Adminhtml_Block_Extensions_Local_Upgrade Mage_Adminhtml_Block_Extensions_Mass_Install Mage_Adminhtml_Block_Extensions_Mass_Uninstall Mage_Adminhtml_Block_Extensions_Mass_Upgrade Mage_Adminhtml_Block_Extensions_Remote_Edit_Form Mage_Adminhtml_Block_Extensions_Remote_Edit_Tab_Abstract Mage_Adminhtml_Block_Newsletter_Queue_Edit_Form Mage_Adminhtml_Block_Newsletter_Template_Edit_Form Mage_Adminhtml_Block_Permissions_Tab_Roleinfo Mage_Adminhtml_Block_Permissions_Tab_Rolesedit Mage_Adminhtml_Block_Permissions_Tab_Useredit Mage_Adminhtml_Block_Permissions_User_Edit_Form Mage_Adminhtml_Block_Permissions_User_Edit_Tab_Main Mage_Adminhtml_Block_Poll_Answer_Edit_Form Mage_Adminhtml_Block_Poll_Edit_Form Mage_Adminhtml_Block_Poll_Edit_Tab_Answers_Form Mage_Adminhtml_Block_Poll_Edit_Tab_Form Mage_Adminhtml_Block_Promo_Catalog_Edit_Form Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Actions Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Conditions Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Main Mage_Adminhtml_Block_Promo_Quote_Edit_Form Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Actions Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Conditions Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main Mage_Adminhtml_Block_Rating_Edit_Form Mage_Adminhtml_Block_Rating_Edit_Tab_Form Mage_Adminhtml_Block_Rating_Edit_Tab_Options Mage_Adminhtml_Block_Review_Add_Form Mage_Adminhtml_Block_Review_Edit_Form Mage_Adminhtml_Block_Sales_Order_Create_Giftmessage_Form Mage_Adminhtml_Block_Sitemap_Edit_Form Mage_Adminhtml_Block_System_Account_Edit_Form Mage_Adminhtml_Block_System_Cache_Form Mage_Adminhtml_Block_System_Config_Form Mage_Adminhtml_Block_System_Convert_Gui_Edit_Form Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Upload Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_View Mage_Adminhtml_Block_System_Convert_Profile_Edit_Form Mage_Adminhtml_Block_System_Convert_Profile_Edit_Tab_Edit Mage_Adminhtml_Block_System_Currency_Edit_Form Mage_Adminhtml_Block_System_Currency_Edit_Tab_Main Mage_Adminhtml_Block_System_Currency_Edit_Tab_Rates Mage_Adminhtml_Block_System_Design_Edit_Tab_General Mage_Adminhtml_Block_System_Email_Template_Edit_Form Mage_Adminhtml_Block_System_Store_Delete_Form Mage_Adminhtml_Block_System_Store_Edit_Form Mage_Adminhtml_Block_Tag_Edit_Form Mage_Adminhtml_Block_Tag_Tag_Edit_Form Mage_Adminhtml_Block_Tax_Class_Edit_Form Mage_Adminhtml_Block_Tax_Rate_Form Mage_Adminhtml_Block_Tax_Rule_Edit_Form Mage_Adminhtml_Block_Urlrewrite_Edit_Form Mage_Adminhtml_Block_Widget_Grid_Massaction_Item_Additional_Default Mage_GoogleBase_Block_Adminhtml_Types_Edit_Form Mage_Googleoptimizer_Block_Adminhtml_Cms_Page_Edit_Tab_Googleoptimizer

List of all members.

Public Member Functions

 __construct ()
 getForm ()
 getFormObject ()
 getFormHtml ()
 setForm (Varien_Data_Form $form)

Protected Member Functions

 _prepareLayout ()
 _prepareForm ()
 _beforeToHtml ()
 _initFormValues ()
 _setFieldset ($attributes, $fieldset, $exclude=array())
 _addElementTypes (Varien_Data_Form_Abstract $baseElement)
 _getAdditionalElementTypes ()
 _getAdditionalElementHtml ($element)

Protected Attributes

 $_form


Detailed Description

Definition at line 34 of file Form.php.


Constructor & Destructor Documentation

__construct (  ) 

Class constructor

Reimplemented from Varien_Object.

Reimplemented in Mage_Adminhtml_Block_Api_Tab_Roleinfo, Mage_Adminhtml_Block_Api_Tab_Rolesedit, Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes, Mage_Adminhtml_Block_Catalog_Category_Tab_Design, Mage_Adminhtml_Block_Catalog_Category_Tab_General, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formattribute, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formgroup, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formset, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Toolbar_Main_Filter, Mage_Adminhtml_Block_Catalog_Search_Edit_Form, Mage_Adminhtml_Block_Checkout_Agreement_Edit_Form, Mage_Adminhtml_Block_Cms_Block_Edit_Form, Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Design, Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Meta, Mage_Adminhtml_Block_Customer_Edit_Tab_Account, Mage_Adminhtml_Block_Customer_Edit_Tab_Addresses, Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter, Mage_Adminhtml_Block_Customer_Online_Filter, Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Abstract, Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Contents, Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Depends, Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Maintainers, Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Package, Mage_Adminhtml_Block_Extensions_Custom_Edit_Tab_Release, Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Actions, Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Changelog, Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Contents, Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Depends, Mage_Adminhtml_Block_Extensions_Local_Edit_Tab_Package, Mage_Adminhtml_Block_Extensions_Remote_Edit_Tab_Actions, Mage_Adminhtml_Block_Extensions_Remote_Edit_Tab_Changelog, Mage_Adminhtml_Block_Extensions_Remote_Edit_Tab_Package, Mage_Adminhtml_Block_Newsletter_Template_Edit_Form, Mage_Adminhtml_Block_Permissions_Tab_Rolesedit, Mage_Adminhtml_Block_Promo_Catalog_Edit_Form, Mage_Adminhtml_Block_Promo_Quote_Edit_Form, Mage_Adminhtml_Block_Sitemap_Edit_Form, Mage_Adminhtml_Block_System_Config_Form, Mage_Adminhtml_Block_System_Convert_Gui_Edit_Tab_Upload, Mage_Adminhtml_Block_System_Currency_Edit_Form, Mage_Adminhtml_Block_System_Store_Delete_Form, Mage_Adminhtml_Block_System_Store_Edit_Form, Mage_Adminhtml_Block_Tag_Edit_Form, Mage_Adminhtml_Block_Tag_Tag_Edit_Form, Mage_Adminhtml_Block_Tax_Class_Edit_Form, Mage_Adminhtml_Block_Tax_Rate_Form, Mage_Adminhtml_Block_Tax_Rule_Edit_Form, Mage_Adminhtml_Block_Urlrewrite_Edit_Form, and Mage_GoogleOptimizer_Block_Adminhtml_Catalog_Category_Edit_Tab_Googleoptimizer.

Definition at line 48 of file Form.php.

00049     {
00050         parent::__construct();
00051         $this->setTemplate('widget/form.phtml');
00052         $this->setDestElementId('edit_form');
00053         $this->setShowGlobalIcon(false);
00054     }


Member Function Documentation

_addElementTypes ( Varien_Data_Form_Abstract baseElement  )  [protected]

Add new element type

Parameters:
Varien_Data_Form_Abstract $baseElement

Definition at line 210 of file Form.php.

00211     {
00212         $types = $this->_getAdditionalElementTypes();
00213         foreach ($types as $code => $className) {
00214             $baseElement->addType($code, $className);
00215         }
00216     }

_beforeToHtml (  )  [protected]

This method is called before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented from Mage_Core_Block_Abstract.

Reimplemented in Mage_Adminhtml_Block_Api_Tab_Roleinfo, and Mage_Adminhtml_Block_Permissions_Tab_Roleinfo.

Definition at line 137 of file Form.php.

00138     {
00139         $this->_prepareForm();
00140         $this->_initFormValues();
00141         return parent::_beforeToHtml();
00142     }

_getAdditionalElementHtml ( element  )  [protected]

Enter description here...

Parameters:
Varien_Data_Form_Element_Abstract $element
Returns:
string

Reimplemented in Mage_Adminhtml_Block_Catalog_Product_Edit_Action_Attribute_Tab_Attributes.

Definition at line 234 of file Form.php.

00235     {
00236         return '';
00237     }

_getAdditionalElementTypes (  )  [protected]

_initFormValues (  )  [protected]

Initialize form fileds values Method will be called after prepareForm and can be used for field values initialization

Returns:
Mage_Adminhtml_Block_Widget_Form

Definition at line 150 of file Form.php.

00151     {
00152         return $this;
00153     }

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented in Mage_Adminhtml_Block_Api_User_Edit_Form, Mage_Adminhtml_Block_Api_User_Edit_Tab_Main, Mage_Adminhtml_Block_Catalog_Category_Tab_Attributes, Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Form, Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Front, Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_Main, Mage_Adminhtml_Block_Catalog_Product_Attribute_Edit_Tab_System, Mage_Adminhtml_Block_Catalog_Product_Attribute_New_Product_Attributes, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formattribute, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formgroup, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formset, Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Toolbar_Main_Filter, Mage_Adminhtml_Block_Catalog_Product_Edit_Action_Attribute_Tab_Attributes, Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Attributes, Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Price, Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Settings, Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Simple, Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Settings, Mage_Adminhtml_Block_Catalog_Search_Edit_Form, Mage_Adminhtml_Block_Checkout_Agreement_Edit_Form, Mage_Adminhtml_Block_Cms_Block_Edit_Form, Mage_Adminhtml_Block_Cms_Page_Edit_Form, Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Design, Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Meta, Mage_Adminhtml_Block_Customer_Edit_Form, Mage_Adminhtml_Block_Customer_Online_Filter, Mage_Adminhtml_Block_Extensions_Console_Edit_Form, Mage_Adminhtml_Block_Extensions_Custom_Edit_Form, Mage_Adminhtml_Block_Extensions_Local_Edit_Form, Mage_Adminhtml_Block_Extensions_Remote_Edit_Form, Mage_Adminhtml_Block_Newsletter_Queue_Edit_Form, Mage_Adminhtml_Block_Newsletter_Template_Edit_Form, Mage_Adminhtml_Block_Permissions_Tab_Useredit, Mage_Adminhtml_Block_Permissions_User_Edit_Form, Mage_Adminhtml_Block_Permissions_User_Edit_Tab_Main, Mage_Adminhtml_Block_Poll_Answer_Edit_Form, Mage_Adminhtml_Block_Poll_Edit_Form, Mage_Adminhtml_Block_Poll_Edit_Tab_Answers_Form, Mage_Adminhtml_Block_Poll_Edit_Tab_Form, Mage_Adminhtml_Block_Promo_Catalog_Edit_Form, Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Actions, Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Conditions, Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Main, Mage_Adminhtml_Block_Promo_Quote_Edit_Form, Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Actions, Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Conditions, Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main, Mage_Adminhtml_Block_Rating_Edit_Form, Mage_Adminhtml_Block_Rating_Edit_Tab_Form, Mage_Adminhtml_Block_Rating_Edit_Tab_Options, Mage_Adminhtml_Block_Review_Add_Form, Mage_Adminhtml_Block_Review_Edit_Form, Mage_Adminhtml_Block_Sales_Order_Create_Giftmessage_Form, Mage_Adminhtml_Block_Sitemap_Edit_Form, Mage_Adminhtml_Block_System_Account_Edit_Form, Mage_Adminhtml_Block_System_Convert_Gui_Edit_Form, Mage_Adminhtml_Block_System_Convert_Profile_Edit_Form, Mage_Adminhtml_Block_System_Currency_Edit_Form, Mage_Adminhtml_Block_System_Design_Edit_Tab_General, Mage_Adminhtml_Block_System_Email_Template_Edit_Form, Mage_Adminhtml_Block_System_Store_Delete_Form, Mage_Adminhtml_Block_System_Store_Edit_Form, Mage_Adminhtml_Block_Tag_Edit_Form, Mage_Adminhtml_Block_Tag_Tag_Edit_Form, Mage_Adminhtml_Block_Tax_Class_Edit_Form, Mage_Adminhtml_Block_Tax_Rate_Form, Mage_Adminhtml_Block_Tax_Rule_Edit_Form, Mage_Adminhtml_Block_Urlrewrite_Edit_Form, Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Attributes, Mage_GoogleBase_Block_Adminhtml_Types_Edit_Form, Mage_Googleoptimizer_Block_Adminhtml_Catalog_Product_Edit_Tab_Googleoptimizer, and Mage_Googleoptimizer_Block_Adminhtml_Cms_Page_Edit_Tab_Googleoptimizer.

Definition at line 127 of file Form.php.

00128     {
00129         return $this;
00130     }

_prepareLayout (  )  [protected]

_setFieldset ( attributes,
fieldset,
exclude = array() 
) [protected]

Set Fieldset to Form

Parameters:
array $attributes attributes that are to be added
Varien_Data_Form_Element_Fieldset $fieldset
array $exclude attributes that should be skipped

Definition at line 162 of file Form.php.

00163     {
00164         $this->_addElementTypes($fieldset);
00165         foreach ($attributes as $attribute) {
00166             /* @var $attribute Mage_Eav_Model_Entity_Attribute */
00167             if (!$attribute || !$attribute->getIsVisible()) {
00168                 continue;
00169             }
00170             if ( ($inputType = $attribute->getFrontend()->getInputType())
00171                  && !in_array($attribute->getAttributeCode(), $exclude)
00172                  && ('media_image' != $inputType)
00173                  ) {
00174 
00175                 $fieldType      = $inputType;
00176                 $rendererClass  = $attribute->getFrontend()->getInputRendererClass();
00177                 if (!empty($rendererClass)) {
00178                     $fieldType  = $inputType . '_' . $attribute->getAttributeCode();
00179                     $fieldset->addType($fieldType, $rendererClass);
00180                 }
00181 
00182                 $element = $fieldset->addField($attribute->getAttributeCode(), $fieldType,
00183                     array(
00184                         'name'      => $attribute->getAttributeCode(),
00185                         'label'     => __($attribute->getFrontend()->getLabel()),
00186                         'class'     => $attribute->getFrontend()->getClass(),
00187                         'required'  => $attribute->getIsRequired(),
00188                         'note'      => $attribute->getNote(),
00189                     )
00190                 )
00191                 ->setEntityAttribute($attribute);
00192 
00193                 $element->setAfterElementHtml($this->_getAdditionalElementHtml($element));
00194 
00195                 if ($inputType == 'select' || $inputType == 'multiselect') {
00196                     $element->setValues($attribute->getSource()->getAllOptions(true, true));
00197                 } elseif ($inputType == 'date') {
00198                     $element->setImage($this->getSkinUrl('images/grid-cal.gif'));
00199                     $element->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
00200                 }
00201             }
00202         }
00203     }

getForm (  ) 

Get form object

Returns:
Varien_Data_Form

Definition at line 78 of file Form.php.

00079     {
00080         return $this->_form;
00081     }

getFormHtml (  ) 

Get form HTML

Returns:
string

Definition at line 100 of file Form.php.

00101     {
00102         if (is_object($this->getForm())) {
00103             return $this->getForm()->getHtml();
00104         }
00105         return '';
00106     }

getFormObject (  ) 

Get form object

Deprecated:
deprecated since version 1.2
See also:
getForm()
Returns:
Varien_Data_Form

Definition at line 90 of file Form.php.

00091     {
00092         return $this->getForm();
00093     }

setForm ( Varien_Data_Form form  ) 

Set form object

Parameters:
Varien_Data_Form $form
Returns:
Mage_Adminhtml_Block_Widget_Form

Definition at line 114 of file Form.php.

00115     {
00116         $this->_form = $form;
00117         $this->_form->setParent($this);
00118         $this->_form->setBaseUrl(Mage::getBaseUrl());
00119         return $this;
00120     }


Member Data Documentation

$_form [protected]

Definition at line 42 of file Form.php.


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

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