/**
  * Wraps control in col-SS-IC when rendering in horizontal mode.
  *
  * WARNING of side effect - replaces 'errors' and 'description' placeholders if they were kept at $pair by default.
  *
  * @param PlaceholderHtml $pair
  * @param Html $control
  * @return Html
  */
 protected function wrapControlInColumnsGrid(PlaceholderHtml $pair, Html $control)
 {
     $r = $this->bootstrapRenderer;
     if ($r->getRenderMode() === RenderModeEnum::HORIZONTAL) {
         // wrap in bootstrap columns
         $columns = Html::el('div')->appendAttribute('class', $r->getColumnsClass($r->getInputColumns()))->addHtml($control);
         if ($pair->getPlaceholder('errors') === $pair) {
             $pair->setPlaceholder($columns, 'errors');
         }
         if ($pair->getPlaceholder('description') === $pair) {
             $pair->setPlaceholder($columns, 'description');
         }
         return $columns;
     } else {
         return $control;
     }
 }
 public static function createDefault()
 {
     $c = new static();
     $c->pair = PlaceholderHtml::el('div', ['class' => 'form-group'])->setPlaceholder('label')->setPlaceholder('control')->setPlaceholder('errors')->setPlaceholder('description');
     $c->emptyLabel = PlaceholderHtml::el('label');
     $c->controlDescription = PlaceholderHtml::el('span', ['class' => 'help-block']);
     $buttonsInner = Html::el('div');
     $c->horizontalButtons = PlaceholderHtml::el('div', ['class' => 'form-group'])->addHtml($buttonsInner)->setPlaceholder($buttonsInner)->setPlaceholder($buttonsInner, 'cols');
     $c->globalErrors = PlaceholderHtml::el();
     $c->globalError = PlaceholderHtml::el('div', ['class' => 'alert alert-warning alert-dismissible', 'role' => 'alert'])->addHtml('<button type="button" class="close" data-dismiss="alert" aria-label="Close">' . '<span aria-hidden="true">&times;</span></button>');
     $c->controlError = PlaceholderHtml::el('span', ['class' => 'help-block text-danger']);
     $c->controlErrors = PlaceholderHtml::el();
     $label = Html::el('legend');
     $description = Html::el('p');
     $c->controlGroup = PlaceholderHtml::el('fieldset')->addHtml($label)->addHtml($description)->setPlaceholder($label, 'label')->setPlaceholder($description, 'description');
     return $c;
 }
 /**
  * @param IControl[] $buttons
  * @return Html
  */
 public function renderButtons(array $buttons)
 {
     if (count($buttons) === 0) {
         return Html::el();
     }
     if ($this->renderMode === RenderModeEnum::HORIZONTAL) {
         $container = clone $this->prototypes->horizontalButtons;
         // set inner grid element to "col-ss-<inputcolumns> col-ss-offset-<labelcolumns>
         $container->getPlaceholder('cols')->appendAttribute('class', $this->getColumnsClass($this->inputColumns))->appendAttribute('class', $this->getOffsetClass($this->labelColumns));
     } else {
         $container = PlaceholderHtml::el();
     }
     $first = TRUE;
     foreach ($buttons as $button) {
         if ($first) {
             $first = FALSE;
         } else {
             $container->addText("\n");
             // inline button separator space
         }
         $container->addHtml($this->renderButton($button));
     }
     return $container;
 }