*/ class Mage_Adminhtml_Block_Customer_Edit_Renderer_Region extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface { /** * Factory instance * * @var Mage_Core_Model_Abstract */ protected $_factory; /** * Constructor for Mage_Adminhtml_Block_Customer_Edit_Renderer_Region class * * @param array $args */ public function __construct(array $args = array()) { $this->_factory = !empty($args['factory']) ? $args['factory'] : Mage::getSingleton('core/factory'); } /** * Output the region element and javasctipt that makes it dependent from country element * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $country = $element->getForm()->getElement('country_id'); if (!is_null($country)) { $countryId = $country->getValue(); } else { return $element->getDefaultHtml(); } $regionId = $element->getForm()->getElement('region_id')->getValue(); $quoteStoreId = $element->getEntityAttribute()->getStoreId(); $html = ''; $element->setClass('input-text'); $element->setRequired(true); $html .= '' . $element->getLabelHtml() . ''; $html .= $element->getElementHtml(); $selectName = str_replace('region', 'region_id', $element->getName()); $selectId = $element->getHtmlId() . '_id'; $html .= ''; $html .= '' . "\n"; $html .= '' . "\n"; return $html; } }