<?php
namespace Moto\Application\Menus; use Moto\InputFilter\AbstractInputFilter; use Moto; class NewMenuFilter extends AbstractInputFilter { protected $_name = 'menus.new'; public function init() { $this->add(array( 'name' => 'name', 'required' => true, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'StringLength', 'options' => array( 'encoding' => 'UTF-8', 'min' => 1, 'max' => 200, ), 'break_chain_on_failure' => true, ), array( 'name' => 'Db\NoRecordExists', 'options' => array( 'table' => Moto\Config::get('database.prefix') . 'menus', 'field' => 'name', 'adapter' => Moto\Config::get('databaseAdapter') ) ) ), )); } }