示例#1
0
 /**
  * {@inheritDoc}
  */
 public function getServiceConfig()
 {
     return array('factories' => array('SxBootstrap\\Service\\BootstrapFilter' => function ($serviceManager) {
         $config = $serviceManager->get('Config');
         $bootstrapConfig = $config['twitter_bootstrap'];
         $BootstrapFilter = new BootstrapFilter($bootstrapConfig);
         return $BootstrapFilter;
     }, 'SxBootstrap\\Service\\BootstrapResolver' => function ($serviceManager) {
         $config = $serviceManager->get('Config');
         $bootstrapConfig = $config['twitter_bootstrap'];
         $assetFilterManager = new BootstrapResolver($bootstrapConfig);
         return $assetFilterManager;
     }, 'formElementErrors' => function ($serviceManager) {
         $fee = new \Zend\Form\View\Helper\FormElementErrors();
         $fee->setMessageCloseString('</li></ul>');
         $fee->setMessageOpenFormat('<ul%s><li>');
         $fee->setMessageSeparatorString('</li><li>');
         $fee->setAttributes(array('class' => 'help-inline'));
         return $fee;
     }));
 }
 /**
  * Row
  *
  * @param ElementInterface|null $element
  * @param null $labelPosition
  * @param null $renderErrors
  * @param null $partial
  * @return null|string|Helper\FormLabel
  */
 public function row(ElementInterface $element = null, $labelPosition = null, $renderErrors = null, $partial = null)
 {
     $helper = new \SpotOnLive\LaravelZf2Form\View\Helper\FormRow();
     return $helper->__invoke($element, $labelPosition, $renderErrors, $partial);
     $method = str_replace('Zend\\Form\\Element\\', '', get_class($element));
     $className = '\\Zend\\Form\\View\\Helper\\Form' . $method;
     if (class_exists($className)) {
         /** @var AbstractHelper|null $helper */
         $helper = new $className();
     }
     if ($parentClass = $this->parentClassName($method)) {
         $method = str_replace('Zend\\Form\\Element\\', '', $parentClass);
         $className = '\\Zend\\Form\\View\\Helper\\Form' . $method;
         if (class_exists($className)) {
             /** @var AbstractHelper|null $helper */
             $helper = new $className();
         }
     }
     if (isset($helper)) {
         $label = new \Zend\Form\View\Helper\FormLabel();
         $elementErrors = new \Zend\Form\View\Helper\FormElementErrors();
         $return = null;
         if ($element->getLabel()) {
             $return = $label->__invoke($element);
         }
         $return .= $helper->render($element);
         $return .= $elementErrors->__invoke($element);
         return $return;
     }
     return '';
 }