示例#1
0
 public function getSpec(ElementInterface $element)
 {
     if ($element instanceof InputProviderInterface) {
         $inputFilter = new ZfInputFilter();
         $inputFilter->add($element->getInputSpecification());
         $inputFilterRender = new InputFilter();
         $data = $inputFilterRender->render($inputFilter);
         return $data[$element->getName()];
     }
     return array('filters' => array(), 'validators' => array());
 }
示例#2
0
 public function renderInputFilter(FormInterface $form, ZfInputFilter $inputFilter = null)
 {
     $data = array();
     $filterRender = new InputFilter();
     $filterData = $filterRender->render($inputFilter);
     foreach ($form as $element) {
         $name = $element->getName();
         if (array_key_exists($name, $filterData)) {
             $spec = $filterData[$name];
             $data[$name] = $spec;
         }
     }
     return $data;
 }