Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Catalog_Model_Entity_Product_Attribute_Design_Options_Container
  • Mage_Catalog_Model_Product_Attribute_Source_Inputtype
  • Mage_Eav_Block_Adminhtml_Attribute_Edit_Js
  • Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
  • Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
  • Mage_Eav_Helper_Data
  • Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype
  • Mage_Eav_Model_Adminhtml_System_Config_Source_Inputtype_Validator
  • Mage_Eav_Model_Attribute
  • Mage_Eav_Model_Attribute_Data
  • Mage_Eav_Model_Attribute_Data_Abstract
  • Mage_Eav_Model_Attribute_Data_Boolean
  • Mage_Eav_Model_Attribute_Data_Date
  • Mage_Eav_Model_Attribute_Data_File
  • Mage_Eav_Model_Attribute_Data_Hidden
  • Mage_Eav_Model_Attribute_Data_Image
  • Mage_Eav_Model_Attribute_Data_Multiline
  • Mage_Eav_Model_Attribute_Data_Multiselect
  • Mage_Eav_Model_Attribute_Data_Select
  • Mage_Eav_Model_Attribute_Data_Text
  • Mage_Eav_Model_Attribute_Data_Textarea
  • Mage_Eav_Model_Config
  • Mage_Eav_Model_Convert_Adapter_Entity
  • Mage_Eav_Model_Convert_Adapter_Grid
  • Mage_Eav_Model_Convert_Parser_Abstract
  • Mage_Eav_Model_Entity
  • Mage_Eav_Model_Entity_Abstract
  • Mage_Eav_Model_Entity_Attribute
  • Mage_Eav_Model_Entity_Attribute_Abstract
  • Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  • Mage_Eav_Model_Entity_Attribute_Backend_Array
  • Mage_Eav_Model_Entity_Attribute_Backend_Datetime
  • Mage_Eav_Model_Entity_Attribute_Backend_Default
  • Mage_Eav_Model_Entity_Attribute_Backend_Increment
  • Mage_Eav_Model_Entity_Attribute_Backend_Serialized
  • Mage_Eav_Model_Entity_Attribute_Backend_Store
  • Mage_Eav_Model_Entity_Attribute_Backend_Time_Created
  • Mage_Eav_Model_Entity_Attribute_Backend_Time_Updated
  • Mage_Eav_Model_Entity_Attribute_Frontend_Abstract
  • Mage_Eav_Model_Entity_Attribute_Frontend_Datetime
  • Mage_Eav_Model_Entity_Attribute_Frontend_Default
  • Mage_Eav_Model_Entity_Attribute_Group
  • Mage_Eav_Model_Entity_Attribute_Option
  • Mage_Eav_Model_Entity_Attribute_Set
  • Mage_Eav_Model_Entity_Attribute_Source_Abstract
  • Mage_Eav_Model_Entity_Attribute_Source_Boolean
  • Mage_Eav_Model_Entity_Attribute_Source_Config
  • Mage_Eav_Model_Entity_Attribute_Source_Store
  • Mage_Eav_Model_Entity_Attribute_Source_Table
  • Mage_Eav_Model_Entity_Collection
  • Mage_Eav_Model_Entity_Collection_Abstract
  • Mage_Eav_Model_Entity_Increment_Abstract
  • Mage_Eav_Model_Entity_Increment_Alphanum
  • Mage_Eav_Model_Entity_Increment_Numeric
  • Mage_Eav_Model_Entity_Setup
  • Mage_Eav_Model_Entity_Store
  • Mage_Eav_Model_Entity_Type
  • Mage_Eav_Model_Form
  • Mage_Eav_Model_Form_Element
  • Mage_Eav_Model_Form_Fieldset
  • Mage_Eav_Model_Form_Type
  • Mage_Eav_Model_Mysql4_Config
  • Mage_Eav_Model_Mysql4_Entity_Attribute
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Group
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Group_Collection
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Option
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Option_Collection
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Set
  • Mage_Eav_Model_Mysql4_Entity_Attribute_Set_Collection
  • Mage_Eav_Model_Mysql4_Entity_Store
  • Mage_Eav_Model_Mysql4_Entity_Type
  • Mage_Eav_Model_Mysql4_Entity_Type_Collection
  • Mage_Eav_Model_Mysql4_Form_Element
  • Mage_Eav_Model_Mysql4_Form_Element_Collection
  • Mage_Eav_Model_Mysql4_Form_Fieldset
  • Mage_Eav_Model_Mysql4_Form_Fieldset_Collection
  • Mage_Eav_Model_Mysql4_Form_Type
  • Mage_Eav_Model_Mysql4_Form_Type_Collection
  • Mage_Eav_Model_Resource_Attribute
  • Mage_Eav_Model_Resource_Attribute_Collection
  • Mage_Eav_Model_Resource_Config
  • Mage_Eav_Model_Resource_Entity_Attribute
  • Mage_Eav_Model_Resource_Entity_Attribute_Collection
  • Mage_Eav_Model_Resource_Entity_Attribute_Group
  • Mage_Eav_Model_Resource_Entity_Attribute_Group_Collection
  • Mage_Eav_Model_Resource_Entity_Attribute_Option
  • Mage_Eav_Model_Resource_Entity_Attribute_Option_Collection
  • Mage_Eav_Model_Resource_Entity_Attribute_Set
  • Mage_Eav_Model_Resource_Entity_Attribute_Set_Collection
  • Mage_Eav_Model_Resource_Entity_Store
  • Mage_Eav_Model_Resource_Entity_Type
  • Mage_Eav_Model_Resource_Entity_Type_Collection
  • Mage_Eav_Model_Resource_Form_Attribute
  • Mage_Eav_Model_Resource_Form_Attribute_Collection
  • Mage_Eav_Model_Resource_Form_Element
  • Mage_Eav_Model_Resource_Form_Element_Collection
  • Mage_Eav_Model_Resource_Form_Fieldset
  • Mage_Eav_Model_Resource_Form_Fieldset_Collection
  • Mage_Eav_Model_Resource_Form_Type
  • Mage_Eav_Model_Resource_Form_Type_Collection
  • Mage_Eav_Model_Resource_Helper_Mysql4

Interfaces

  • Mage_Eav_Model_Entity_Attribute_Backend_Interface
  • Mage_Eav_Model_Entity_Attribute_Frontend_Interface
  • Mage_Eav_Model_Entity_Attribute_Interface
  • Mage_Eav_Model_Entity_Attribute_Source_Interface
  • Mage_Eav_Model_Entity_Increment_Interface
  • Mage_Eav_Model_Entity_Interface

Exceptions

  • Mage_Eav_Exception
  • Mage_Eav_Model_Entity_Attribute_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Eav
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * Product attribute add/edit form main tab
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_Eav
 33:  * @author     Magento Core Team <core@magentocommerce.com>
 34:  */
 35: abstract class Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract extends Mage_Adminhtml_Block_Widget_Form
 36: {
 37:     protected $_attribute = null;
 38: 
 39:     public function setAttributeObject($attribute)
 40:     {
 41:         $this->_attribute = $attribute;
 42:         return $this;
 43:     }
 44: 
 45:     public function getAttributeObject()
 46:     {
 47:         if (null === $this->_attribute) {
 48:             return Mage::registry('entity_attribute');
 49:         }
 50:         return $this->_attribute;
 51:     }
 52: 
 53:     /**
 54:      * Preparing default form elements for editing attribute
 55:      *
 56:      * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
 57:      */
 58:     protected function _prepareForm()
 59:     {
 60:         $attributeObject = $this->getAttributeObject();
 61: 
 62:         $form = new Varien_Data_Form(array(
 63:             'id' => 'edit_form',
 64:             'action' => $this->getData('action'),
 65:             'method' => 'post'
 66:         ));
 67: 
 68:         $fieldset = $form->addFieldset('base_fieldset',
 69:             array('legend'=>Mage::helper('eav')->__('Attribute Properties'))
 70:         );
 71:         if ($attributeObject->getAttributeId()) {
 72:             $fieldset->addField('attribute_id', 'hidden', array(
 73:                 'name' => 'attribute_id',
 74:             ));
 75:         }
 76: 
 77:         $this->_addElementTypes($fieldset);
 78: 
 79:         $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
 80: 
 81:         $validateClass = sprintf('validate-code validate-length maximum-length-%d',
 82:             Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH);
 83:         $fieldset->addField('attribute_code', 'text', array(
 84:             'name'  => 'attribute_code',
 85:             'label' => Mage::helper('eav')->__('Attribute Code'),
 86:             'title' => Mage::helper('eav')->__('Attribute Code'),
 87:             'note'  => Mage::helper('eav')->__('For internal use. Must be unique with no spaces. Maximum length of attribute code must be less then %s symbols', Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH),
 88:             'class' => $validateClass,
 89:             'required' => true,
 90:         ));
 91: 
 92:         $inputTypes = Mage::getModel('eav/adminhtml_system_config_source_inputtype')->toOptionArray();
 93: 
 94:         $fieldset->addField('frontend_input', 'select', array(
 95:             'name' => 'frontend_input',
 96:             'label' => Mage::helper('eav')->__('Catalog Input Type for Store Owner'),
 97:             'title' => Mage::helper('eav')->__('Catalog Input Type for Store Owner'),
 98:             'value' => 'text',
 99:             'values'=> $inputTypes
100:         ));
101: 
102:         $fieldset->addField('default_value_text', 'text', array(
103:             'name' => 'default_value_text',
104:             'label' => Mage::helper('eav')->__('Default Value'),
105:             'title' => Mage::helper('eav')->__('Default Value'),
106:             'value' => $attributeObject->getDefaultValue(),
107:         ));
108: 
109:         $fieldset->addField('default_value_yesno', 'select', array(
110:             'name' => 'default_value_yesno',
111:             'label' => Mage::helper('eav')->__('Default Value'),
112:             'title' => Mage::helper('eav')->__('Default Value'),
113:             'values' => $yesno,
114:             'value' => $attributeObject->getDefaultValue(),
115:         ));
116: 
117:         $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
118:         $fieldset->addField('default_value_date', 'date', array(
119:             'name'   => 'default_value_date',
120:             'label'  => Mage::helper('eav')->__('Default Value'),
121:             'title'  => Mage::helper('eav')->__('Default Value'),
122:             'image'  => $this->getSkinUrl('images/grid-cal.gif'),
123:             'value'  => $attributeObject->getDefaultValue(),
124:             'format'       => $dateFormatIso
125:         ));
126: 
127:         $fieldset->addField('default_value_textarea', 'textarea', array(
128:             'name' => 'default_value_textarea',
129:             'label' => Mage::helper('eav')->__('Default Value'),
130:             'title' => Mage::helper('eav')->__('Default Value'),
131:             'value' => $attributeObject->getDefaultValue(),
132:         ));
133: 
134:         $fieldset->addField('is_unique', 'select', array(
135:             'name' => 'is_unique',
136:             'label' => Mage::helper('eav')->__('Unique Value'),
137:             'title' => Mage::helper('eav')->__('Unique Value (not shared with other products)'),
138:             'note'  => Mage::helper('eav')->__('Not shared with other products'),
139:             'values' => $yesno,
140:         ));
141: 
142:         $fieldset->addField('is_required', 'select', array(
143:             'name' => 'is_required',
144:             'label' => Mage::helper('eav')->__('Values Required'),
145:             'title' => Mage::helper('eav')->__('Values Required'),
146:             'values' => $yesno,
147:         ));
148: 
149:         $fieldset->addField('frontend_class', 'select', array(
150:             'name'  => 'frontend_class',
151:             'label' => Mage::helper('eav')->__('Input Validation for Store Owner'),
152:             'title' => Mage::helper('eav')->__('Input Validation for Store Owner'),
153:             'values'=> Mage::helper('eav')->getFrontendClasses($attributeObject->getEntityType()->getEntityTypeCode())
154:         ));
155: 
156:         if ($attributeObject->getId()) {
157:             $form->getElement('attribute_code')->setDisabled(1);
158:             $form->getElement('frontend_input')->setDisabled(1);
159:             if (!$attributeObject->getIsUserDefined()) {
160:                 $form->getElement('is_unique')->setDisabled(1);
161:             }
162:         }
163: 
164:         $this->setForm($form);
165: 
166:         return parent::_prepareForm();
167:     }
168: 
169:     /**
170:      * Initialize form fileds values
171:      *
172:      * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
173:      */
174:     protected function _initFormValues()
175:     {
176:         Mage::dispatchEvent('adminhtml_block_eav_attribute_edit_form_init', array('form' => $this->getForm()));
177:         $this->getForm()
178:             ->addValues($this->getAttributeObject()->getData());
179:         return parent::_initFormValues();
180:     }
181: 
182:     /**
183:      * This method is called before rendering HTML
184:      *
185:      * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
186:      */
187:     protected function _beforeToHtml()
188:     {
189:         parent::_beforeToHtml();
190:         $attributeObject = $this->getAttributeObject();
191:         if ($attributeObject->getId()) {
192:             $form = $this->getForm();
193:             $disableAttributeFields = Mage::helper('eav')
194:                 ->getAttributeLockedFields($attributeObject->getEntityType()->getEntityTypeCode());
195:             if (isset($disableAttributeFields[$attributeObject->getAttributeCode()])) {
196:                 foreach ($disableAttributeFields[$attributeObject->getAttributeCode()] as $field) {
197:                     if ($elm = $form->getElement($field)) {
198:                         $elm->setDisabled(1);
199:                         $elm->setReadonly(1);
200:                     }
201:                 }
202:             }
203:         }
204:         return $this;
205:     }
206: 
207:     /**
208:      * Processing block html after rendering
209:      * Adding js block to the end of this block
210:      *
211:      * @param   string $html
212:      * @return  string
213:      */
214:     protected function _afterToHtml($html)
215:     {
216:         $jsScripts = $this->getLayout()
217:             ->createBlock('eav/adminhtml_attribute_edit_js')->toHtml();
218:         return $html.$jsScripts;
219:     }
220: 
221: }
222: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0