Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

custom attribute backend type code disabled? 
 
JonUK
Jr. Member
 
Total Posts:  7
Joined:  2008-11-15
 

Hi, the following code from

class Mage_Eav_Model_Entity_Attribute
contains an uncommented section:

/**
     * Detect default value using frontend input type
     *
     * @return string default_value field value
     * @param string $type frontend_input field name
     */
    public function getDefaultValueByInput($type)
    
{
        $field 
'';
        switch (
$type{
            
case 'select':
            case 
'gallery':
            case 
'media_image':
            case 
'multiselect':
                return 
'';

            case 
'text':
            case 
'price':
            case 
'image':
                
$field 'default_value_text';
                break;

            case 
'textarea':
                
$field 'default_value_textarea';
                break;

            case 
'date':
                
$field 'default_value_date';
                break;

            case 
'boolean':
                
$field 'default_value_yesno';
                break;
/*
            default:
                Mage::dispatchEvent('eav_attribute_get_default_value_by_input', array('model'=>$this, 'type'=>$type));
                if ($this->hasBackendTypeByInput()) {
                    return $this->getData('backend_type_by_input');
                }
                Mage::throwException('Unknown frontend input type');
*/
        
}

        
return $field;
    
}

Could someone explain if this is because the event

eav_attribute_get_default_value_by_input
is in some way dangerous to use (i.e. it has knock on problematic effects elsewhere in the framework), or whether this is just a feature being held back?

I would really like to use this code; the only alternative seems to be sub-classing, which is far less compliant with multiple custom modules.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top