1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33: 34:
35:
36: class Mage_Adminhtml_Block_Catalog_Form_Renderer_Attribute_Urlkey
37: extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element
38: {
39: public function getElementHtml()
40: {
41: $element = $this->getElement();
42: if(!$element->getValue()) {
43: return parent::getElementHtml();
44: }
45: $element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')");
46: $element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')");
47:
48: $data = array(
49: 'name' => $element->getData('name') . '_create_redirect',
50: 'disabled' => true,
51: );
52: $hidden = new Varien_Data_Form_Element_Hidden($data);
53: $hidden->setForm($element->getForm());
54:
55: $storeId = $element->getForm()->getDataObject()->getStoreId();
56: $data['html_id'] = $element->getHtmlId() . '_create_redirect';
57: $data['label'] = Mage::helper('catalog')->__('Create Permanent Redirect for old URL');
58: $data['value'] = $element->getValue();
59: $data['checked'] = Mage::helper('catalog')->shouldSaveUrlRewritesHistory($storeId);
60: $checkbox = new Varien_Data_Form_Element_Checkbox($data);
61: $checkbox->setForm($element->getForm());
62:
63: return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
64: }
65: }
66: