当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Eav_Model_Entity_Attribute::getFrontendLabel方法代码示例

本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute::getFrontendLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute::getFrontendLabel方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute::getFrontendLabel怎么用?PHP Mage_Eav_Model_Entity_Attribute::getFrontendLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Eav_Model_Entity_Attribute的用法示例。


在下文中一共展示了Mage_Eav_Model_Entity_Attribute::getFrontendLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _createField

 /**
  * Create Field and Return it
  *
  * @param Varien_Data_Form_Element_Abstract $fieldset
  * @param Varien_Object                     $e
  * @param Mage_Eav_Model_Entity_Attribute   $attribute
  * @param string                            $fieldStep
  *
  * @return Varien_Data_Form_Element_Abstract
  */
 protected function _createField(Varien_Data_Form_Element_Abstract $fieldset, Varien_Object $e, Mage_Eav_Model_Entity_Attribute $attribute, $fieldStep = 'standard')
 {
     // Get Config Data
     $configData = $this->getConfigData();
     if ('' == $attribute->getFrontendLabel()) {
         return false;
     }
     // Define Attribute Code
     $attributeCode = $attribute->getAttributeCode();
     $attributeCode = $fieldStep == 'newfield' ? "{$attributeCode}_dynamic_new" : $attributeCode;
     // Get Attribute Data and Inheritance
     $path = $this->_configPath . $attributeCode;
     if (isset($configData[$path])) {
         $data = $configData[$path];
         $inherit = false;
     } else {
         $data = (string) Mage::getConfig()->getNode(null, $this->getForm()->getScope(), $this->getForm()->getScopeCode())->descend($path);
         $inherit = true;
     }
     // Get field Renderer
     if ($e->frontend_model) {
         $fieldRenderer = Mage::getBlockSingleton((string) $e->frontend_model);
     } else {
         $fieldRenderer = $this->_getFieldRenderer();
     }
     // Define Type, Name, and Label
     $fieldType = (string) $e->frontend_type ? (string) $e->frontend_type : 'text';
     $name = str_replace('_attrCode_', $attributeCode, $this->_fieldNameTemplate);
     $label = $fieldStep == 'newfield' ? "" : $attribute->getFrontendLabel();
     // Pass through backend model in case it needs to modify value
     if ($e->backend_model) {
         $model = Mage::getModel((string) $e->backend_model);
         if (!$model instanceof Mage_Core_Model_Config_Data) {
             Mage::throwException('Invalid config field backend model: ' . (string) $e->backend_model);
         }
         $model->setPath($path)->setValue($data)->afterLoad();
         $data = $model->getValue();
     }
     // Pre-populate New field with label text
     if ('newfield' == $fieldStep && '' == $data) {
         $data = $attribute->getFrontendLabel();
     }
     // Select Field for Existing attributes.
     $field = $fieldset->addField($attributeCode, $fieldType, array('name' => $name, 'label' => $label, 'value' => $data === 0 ? '' : $data, 'inherit' => $fieldStep == 'newfield' ? false : $inherit, 'field_config' => $e, 'scope' => $this->getForm()->getScope(), 'scopeId' => $this->getForm()->getScopeId(), 'scope_label' => '[STORE VIEW]', 'can_use_default_value' => $this->getForm()->canUseDefaultValue((int) $e->show_in_default), 'can_use_website_value' => $this->getForm()->canUseWebsiteValue((int) $e->show_in_website), 'can_use_store_value' => $this->getForm()->canUseWebsiteValue((int) $e->show_in_store)));
     // Add Validation
     if ($e->validate) {
         $field->addClass($e->validate);
     }
     // Determine if value can be empty
     if (isset($e->frontend_type) && 'multiselect' === (string) $e->frontend_type && isset($e->can_be_empty)) {
         $field->setCanBeEmpty(true);
     }
     // Set Field Renderer
     $field->setRenderer($fieldRenderer);
     // Use Source Model to define available options
     if ($e->source_model) {
         $sourceModel = Mage::getSingleton((string) $e->source_model);
         if ($sourceModel instanceof Varien_Object) {
             $sourceModel->setPath($path);
         }
         $field->setValues($sourceModel->toOptionArray());
     }
     return $field;
 }
开发者ID:bevello,项目名称:bevello,代码行数:74,代码来源:Attributes.php


注:本文中的Mage_Eav_Model_Entity_Attribute::getFrontendLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。