Ejemplo n.º 1
0
 /**
  * Retrieve input filter used by this form
  *
  * @return null|InputFilterInterface
  */
 public function getInputFilter()
 {
     if ($this->object instanceof InputFilterAwareInterface) {
         if (null == $this->baseFieldset) {
             $this->filter = $this->object->getInputFilter();
         } else {
             $name = $this->baseFieldset->getName();
             if (!$this->filter instanceof InputFilterInterface || !$this->filter->has($name)) {
                 $filter = new InputFilter();
                 $filter->setFactory($this->getFormFactory()->getInputFilterFactory());
                 $filter->add($this->object->getInputFilter(), $name);
                 $this->filter = $filter;
             }
         }
     }
     if (!isset($this->filter)) {
         $this->filter = new InputFilter();
         $this->filter->setFactory($this->getFormFactory()->getInputFilterFactory());
     }
     if (!$this->hasAddedInputFilterDefaults && $this->filter instanceof InputFilterInterface && $this->useInputFilterDefaults()) {
         $this->attachInputFilterDefaults($this->filter, $this);
         $this->hasAddedInputFilterDefaults = true;
     }
     return $this->filter;
 }