*/ class Mage_Admin_Model_Block extends Mage_Core_Model_Abstract { /** * Initialize variable model */ protected function _construct() { $this->_init('admin/block'); } /** * @return array|bool * @throws Exception * @throws Zend_Validate_Exception */ public function validate() { $errors = array(); if (!Zend_Validate::is($this->getBlockName(), 'NotEmpty')) { $errors[] = Mage::helper('adminhtml')->__('Block Name is required field.'); } if (!Zend_Validate::is($this->getBlockName(), 'Regex', array('/^[-_a-zA-Z0-9\/]*$/'))) { $errors[] = Mage::helper('adminhtml')->__('Block Name is incorrect.'); } if (!in_array($this->getIsAllowed(), array('0', '1'))) { $errors[] = Mage::helper('adminhtml')->__('Is Allowed is required field.'); } if (empty($errors)) { return true; } return $errors; } /** * Check is block with such type allowed for parsing via blockDirective method * * @param string $type * @return bool */ public function isTypeAllowed($type) { return Mage::helper('admin/block')->isTypeAllowed($type); } }