Mage_Eav_Model_Entity_Attribute_Frontend_Abstract Class Reference

Inheritance diagram for Mage_Eav_Model_Entity_Attribute_Frontend_Abstract:

Mage_Eav_Model_Entity_Attribute_Frontend_Interface Mage_Catalog_Model_Entity_Product_Attribute_Frontend_Image Mage_Catalog_Model_Product_Attribute_Frontend_Image Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Attribute_Frontend_Image Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Frontend_Image Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Attribute_Frontend_Tierprice Mage_Eav_Model_Entity_Attribute_Frontend_Datetime Mage_Eav_Model_Entity_Attribute_Frontend_Default Mage_Sales_Model_Entity_Quote_Address_Attribute_Frontend Mage_Sales_Model_Mysql4_Quote_Address_Attribute_Frontend

List of all members.

Public Member Functions

 setAttribute ($attribute)
 getAttribute ()
 getInputType ()
 getLabel ()
 getValue (Varien_Object $object)
 isVisible ()
 getClass ()
 getConfigField ($fieldName)
 getSelectOptions ()
 getOption ($optionId)
 getInputRendererClass ()

Protected Attributes

 $_attribute


Detailed Description

Definition at line 35 of file Abstract.php.


Member Function Documentation

getAttribute (  ) 

Get attribute instance

Returns:
Mage_Eav_Model_Entity_Attribute_Abstract

Definition at line 62 of file Abstract.php.

00063     {
00064         return $this->_attribute;
00065     }

getClass (  ) 

Definition at line 122 of file Abstract.php.

00123     {
00124         $out = $this->getAttribute()->getFrontendClass();
00125         if ($this->getAttribute()->getIsRequired()) {
00126             $out .= ' required-entry';
00127         }
00128         return $out;
00129     }

getConfigField ( fieldName  ) 

Definition at line 131 of file Abstract.php.

00132     {
00133         return $this->getAttribute()->getData('frontend_'.$fieldName);
00134     }

getInputRendererClass (  ) 

Retrieve Input Renderer Class

Returns:
string

Definition at line 159 of file Abstract.php.

00159                                             {
00160         if ($className = $this->getAttribute()->getData('frontend_input_renderer')) {
00161             return Mage::getConfig()->getBlockClassName($className);
00162         }
00163         return null;
00164     }

getInputType (  ) 

Get attribute type for user interface form

Returns:
string

Definition at line 72 of file Abstract.php.

00073     {
00074         return $this->getAttribute()->getFrontendInput();
00075     }

getLabel (  ) 

Enter description here...

Returns:
string

Definition at line 82 of file Abstract.php.

00083     {
00084         $label = $this->getAttribute()->getFrontendLabel();
00085         if (is_null($label) || $label=='') {
00086             $label = $this->getAttribute()->getAttributeCode();
00087         }
00088         return $label;
00089     }

getOption ( optionId  ) 

Definition at line 146 of file Abstract.php.

00147     {
00148         if ($source = $this->getAttribute()->getSource()) {
00149             return $source->getOptionText($optionId);
00150         }
00151         return false;
00152     }

getSelectOptions (  ) 

Get select options in case it's select box and options source is defined

Returns:
array

Definition at line 141 of file Abstract.php.

00142     {
00143         return $this->getAttribute()->getSource()->getAllOptions();
00144     }

getValue ( Varien_Object object  ) 

Reimplemented in Mage_Eav_Model_Entity_Attribute_Frontend_Datetime.

Definition at line 91 of file Abstract.php.

00092     {
00093         $value = $object->getData($this->getAttribute()->getAttributeCode());
00094         if (in_array($this->getConfigField('input'), array('select','boolean'))) {
00095             $valueOption = $this->getOption($value);
00096             if (!$valueOption) {
00097                 $opt = new Mage_Eav_Model_Entity_Attribute_Source_Boolean();
00098                 if ($options = $opt->getAllOptions()) {
00099                     foreach ($options as $option) {
00100                         if ($option['value'] == $value) {
00101                             $valueOption = $option['label'];
00102                         }
00103                     }
00104                 }
00105             }
00106             $value = $valueOption;
00107         }
00108         elseif ($this->getConfigField('input')=='multiselect') {
00109             $value = $this->getOption($value);
00110             if (is_array($value)) {
00111                 $value = implode(', ', $value);
00112             }
00113         }
00114         return $value;
00115     }

isVisible (  ) 

Definition at line 117 of file Abstract.php.

00118     {
00119         return $this->getConfigField('frontend_visible');
00120     }

setAttribute ( attribute  ) 

Set attribute instance

Parameters:
Mage_Eav_Model_Entity_Attribute_Abstract $attribute
Returns:
Mage_Eav_Model_Entity_Attribute_Frontend_Abstract

Definition at line 51 of file Abstract.php.

00052     {
00053         $this->_attribute = $attribute;
00054         return $this;
00055     }


Member Data Documentation

$_attribute [protected]

Definition at line 43 of file Abstract.php.


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

Generated on Sat Jul 4 17:24:10 2009 for Magento by  doxygen 1.5.8