*/ class Mage_Oauth_Block_Adminhtml_Oauth_Consumer_Edit extends Mage_Adminhtml_Block_Widget_Form_Container { /** * Consumer model * * @var Mage_Oauth_Model_Consumer */ protected $_model; /** * Get consumer model * * @return Mage_Oauth_Model_Consumer */ public function getModel() { if (null === $this->_model) { $this->_model = Mage::registry('current_consumer'); } return $this->_model; } /** * Construct edit page */ public function __construct() { parent::__construct(); $this->_blockGroup = 'oauth'; $this->_controller = 'adminhtml_oauth_consumer'; $this->_mode = 'edit'; $this->_addButton('save_and_continue', array( 'label' => Mage::helper('oauth')->__('Save and Continue Edit'), 'onclick' => 'saveAndContinueEdit()', 'class' => 'save' ), 100); $this->_formScripts[] = "function saveAndContinueEdit()" . "{editForm.submit($('edit_form').action + 'back/edit/')}"; $this->_updateButton('save', 'label', $this->__('Save')); $this->_updateButton('save', 'id', 'save_button'); $this->_updateButton('delete', 'label', $this->__('Delete')); /** @var $session Mage_Admin_Model_Session */ $session = Mage::getSingleton('admin/session'); if (!$this->getModel()->getId() || !$session->isAllowed('system/oauth/consumer/delete')) { $this->_removeButton('delete'); } } /** * Get header text * * @return string */ public function getHeaderText() { if ($this->getModel()->getId()) { return $this->__('Edit Consumer'); } else { return $this->__('New Consumer'); } } }