/**
  * @param GenerateEvent $event
  */
 public static function handleWidgetGenerateEvent(GenerateEvent $event)
 {
     $widget = $event->getWidget();
     $inputGroup = $event->getContainer()->getWrapper();
     $template = static::getIconSetTemplateWhenEnabled($inputGroup, $widget);
     self::addIcon($template, $widget, $inputGroup);
 }
示例#2
0
 /**
  * @param GenerateEvent $event
  */
 public function generate(GenerateEvent $event)
 {
     $container = $event->getContainer();
     $element = $event->getContainer()->getElement();
     $widget = $event->getWidget();
     $label = $event->getLabel();
     $errors = $event->getErrors();
     // add label class
     $label->addClass('control-label');
     $errors->addClass('help-block');
     if (!$widget->label || $this->getConfig($widget->type, 'noLabel')) {
         $label->hide();
     }
     $this->setColumnLayout($widget, $container, $label);
     $this->adjustElement($event, $element, $widget, $container);
     $this->addInputGroup($widget, $container, $element);
     // inject errors into container
     $container->addChild('errors', $errors);
 }
示例#3
0
 /**
  * @param GenerateEvent $event
  */
 public function createModalFooter(GenerateEvent $event)
 {
     $widget = $event->getWidget();
     $element = $event->getContainer()->getElement();
     if ($this->isPartOfModalFooter($widget)) {
         $buttons = (array) Bootstrap::getConfigVar('runtime.modal-footer');
         // create copy for footer
         /** @var Element $element */
         $copy = clone $element;
         $copy->setAttribute('onclick', sprintf('$(\'#ctrl_%s\').click();', $widget->id));
         $copy->setId('md_' . $element->getId());
         $copy->addClass('btn');
         $buttons[] = $copy;
         Bootstrap::setConfigVar('runtime.modal-footer', $buttons);
     }
 }
示例#4
0
 /**
  * @param GenerateEvent $event
  */
 public function createModalFooter(GenerateEvent $event)
 {
     $widget = $event->getWidget();
     $element = $event->getContainer()->getElement();
     if ($this->isModal($widget)) {
         // create copy for footer
         $copy = clone $element;
         // make sure that we can modify the element
         if ($element instanceof Element) {
             $copy->setAttribute('onclick', sprintf('$(\'#ctrl_%s\').click();', $widget->id));
             $copy->setId('md_' . $element->getId());
             $copy->addClass('btn');
         }
         $GLOBALS['bootstrapModalForm'] .= $copy->generate();
         $element->setAttribute('style', 'display:none;');
     }
 }