/**
  * @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);
 }
Example #2
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);
     }
 }
 /**
  * @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;');
     }
 }
 /**
  * @param GenerateEvent $event
  * @param $element
  * @param $widget
  * @param $container
  */
 private function adjustElement(GenerateEvent $event, $element, $widget, $container)
 {
     if ($element instanceof Element) {
         // apply form control class to the element
         if (!$this->getConfig($widget->type, 'noFormControl')) {
             $element->addClass('form-control');
         }
         // enable styled select
         if ($GLOBALS['BOOTSTRAP']['form']['styleSelect']['enabled'] && $this->getConfig($widget->type, 'styleSelect')) {
             $element->addClass($GLOBALS['BOOTSTRAP']['form']['styleSelect']['class']);
             $element->setAttribute('data-style', $GLOBALS['BOOTSTRAP']['form']['styleSelect']['style']);
         }
         if ($event->getWidget()->type == 'upload' && $GLOBALS['BOOTSTRAP']['form']['styledUpload']['enabled']) {
             $this->generateUpload($container);
         }
     }
 }