Beispiel #1
0
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->order = array($this->alias . '.menu_id' => 'ASC', $this->alias . '.lft' => 'ASC');
     $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('menus', 'Please enter the name of the menu item, this is what users will see'), 'required' => true)), 'link' => array('validateEitherOr' => array('rule' => array('validateEitherOr', array('link', 'plugin')), 'message' => __d('menus', 'Please only use external link or the route'), 'required' => true), 'validUrl' => array('rule' => 'validateUrlOrAbsolute', 'message' => __d('menus', 'please use a valid url (absolute or full)'))), 'plugin' => array('validateEitherOr' => array('rule' => array('validateEitherOr', array('link', 'plugin')), 'message' => __d('menus', 'Please use the external link or the route'))), 'force_frontend' => array('validateNothingEitherOr' => array('rule' => array('validateNothingEitherOr', array('force_backend', 'force_frontend')), 'allowEmpty' => true, 'message' => __d('menus', 'You can only force one area of the site'))), 'force_backend' => array('validateNothingEitherOr' => array('rule' => array('validateNothingEitherOr', array('force_backend', 'force_frontend')), 'allowEmpty' => true, 'message' => __d('menus', 'You can only force one area of the site'))), 'group_id' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('menus', 'Please select the group that can see this link'), 'required' => true)), 'params' => array('emptyOrJson' => array('rule' => 'validateJson', 'allowEmpty' => true, 'message' => __d('menus', 'Please enter some valid json or leave empty'))), 'class' => array('emptyOrValidCssClass' => array('rule' => 'validateEmptyOrCssClass', 'message' => __d('menus', 'Please enter valid css classes'))), 'menu_id' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __d('menus', 'Please select the menu this item belongs to'), 'required' => true)), 'parent_id' => array());
 }
Beispiel #2
0
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter a name for the menu')), 'validName' => array('rule' => '/[a-z_]{1,100}/i', 'message' => __('Please enter a name for the menu lower case letters and under-scores only')), 'isUnique' => array('rule' => 'isUnique', 'message' => __('There is already a menu with that name'))), 'type' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the menu type')), 'validName' => array('rule' => '/[a-z_]{1,100}/i', 'message' => __('Please enter a valid type for the menu lower case letters and under-scores only'))));
 }