<?php
namespace Moto\Filter; use Moto; class ClickAction extends AbstractFilter { protected $_inputFilter = null; public function __construct($options = array()) { if (isset($options['inputFilter'])) { $this->setInputFilter($options['inputFilter']); } } public function setInputFilter($inputFilter) { $this->_inputFilter = $inputFilter; } public function filter($value, $action = null) { $result = array(); if (null === $value) { return $result; } if (empty($action)) { $action = $this->_inputFilter->getValue('action'); } $inputFilter = Moto\ClickAction\Factory::getFilter($action); if (null !== $inputFilter) { if ($inputFilter instanceof \Closure || is_callable($inputFilter)) { $result = call_user_func($inputFilter, $value); } elseif ($inputFilter instanceof Moto\InputFilter\AbstractInputFilter) { $inputFilter->setData($value); $result = $inputFilter->getValues(); } } return $result; } } 