<?php
namespace Moto\Application\MediaLibrary\InputFilter; use Moto\Application\MediaLibrary; use Moto\InputFilter\AbstractInputFilter; use Moto; class NewFolder extends AbstractInputFilter { protected $_name = 'mediaLibraryFolder.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' => 'Moto\Application\MediaLibrary\Validator\UniqueTreeItem', 'options' => array( 'table' => Moto\Config::get('database.prefix') . 'media_folders', 'field' => 'name', 'adapter' => Moto\Config::get('databaseAdapter'), ) ) ), )); $this->add(array( 'name' => 'parent_id', 'required' => true, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), ), 'validators' => array( array( 'name' => 'Digits', 'break_chain_on_failure' => true, ), array( 'name' => 'Moto\Validator\ParentId', 'options' => array( 'table' => Moto\Config::get('database.prefix') . 'media_folders', 'field' => 'id', 'adapter' => Moto\Config::get('databaseAdapter'), ) ) ), )); $this->add(array( 'name' => 'order', 'required' => true, 'filters' => array( array('name' => 'StripTags'), array('name' => 'StringTrim'), array('name' => 'Moto\Filter\IntValue'), array('name' => 'Moto\Filter\DefaultFilter') ), 'validators' => array( array( 'name' => 'Digits' ) ), )); } }