public function run()
 {
     $this->options = ArrayHelper::merge(['md-selected-item' => $this->selectedItem, 'md-search-text-change' => $this->replaceSearchText($this->searchTextChange), 'md-search-text' => $this->searchText, 'md-selected-item-change' => $this->replaceSearchText($this->selectedItemChange), 'md-items' => $this->replaceSearchText($this->items), 'md-item-text' => $this->itemText, 'md-min-length' => $this->minLength, 'md-delay' => $this->delay, 'placeholder' => $this->placeholder, 'md-menu-class' => $this->menuClass], $this->options);
     $hiddenInput = Html::activeHiddenInput($this->model, $this->attribute);
     $itemTemplate = Html::tag('md-item-template', $this->itemTemplate);
     $notFound = Html::tag('md-not-found', $this->notFound);
     return $hiddenInput . Html::tag('md-autocomplete', $itemTemplate . $notFound, $this->options);
 }
Exemplo n.º 2
0
 public function run()
 {
     $this->inputOptions = ArrayHelper::merge(['placeholder' => !empty($this->placeholder) ? $this->placeholder : null, 'ng-model' => !empty($this->bufferModel) ? $this->bufferModel : null], $this->inputOptions);
     $chipTemplate = $this->chipTemplate ? Html::tag('md-chip-template', $this->chipTemplate) : '';
     if ($this->model && $this->attribute) {
         echo Html::activeHiddenInput($this->model, $this->attribute);
     }
     $content = Html::textInput(null, null, $this->inputOptions);
     echo Html::tag('md-chips', $content . $chipTemplate, $this->options);
 }
 public function run()
 {
     $this->options = ArrayHelper::merge(['md-autocomplete-snap' => !empty($this->autocompleteSnap) ? $this->autocompleteSnap : null, 'md-require-match' => !empty($this->requireMatch) ? $this->requireMatch : null], $this->options);
     $chipTemplate = $this->chipTemplate ? Html::tag('md-chip-template', $this->chipTemplate) : '';
     $this->autocompleteConfig = ArrayHelper::merge(['items' => $this->items, 'itemText' => $this->itemText, 'itemTemplate' => $this->itemTemplate, 'placeholder' => $this->placeholder], $this->autocompleteConfig);
     if ($this->model && $this->attribute) {
         echo Html::activeHiddenInput($this->model, $this->attribute);
     }
     $content = MdAutocomplete::widget($this->autocompleteConfig);
     echo Html::tag('md-chips', $content . $chipTemplate, $this->options);
 }
Exemplo n.º 4
0
 /**
  * @param AngularValidator $validator The angular validator to get the validators from
  * @param Model $model The model instance
  * @param string $attribute The name of the attribute to get the ngMessages from
  * @return string The ngMessages HTML
  */
 public static function ngMessages($validator, $model, $attribute)
 {
     $validators = $validator->validators();
     $messages = $validator->prepareMessages($model, $attribute);
     $ngMessages = [];
     foreach ($messages as $name => $message) {
         $ngMessages[] = Html::tag('div', $message, ['ng-message' => isset($validators[$name]) ? $validators[$name] : $validator->directive]);
     }
     return implode("\n", $ngMessages);
 }
 /**
  * Renders a list of radio buttons.
  * A radio button list is like a checkbox list, except that it only allows single selection.
  * The selection of the radio buttons is taken from the value of the model attribute.
  * @param array $items the data item used to generate the radio buttons.
  * The array values are the labels, while the array keys are the corresponding radio values.
  * @param array $options options (name => config) for the radio button list.
  * For the list of available options please refer to the `$options` parameter of [[\yii\helpers\Html::activeRadioList()]].
  * @return $this the field object itself
  */
 public function radioList($items, $options = [])
 {
     $this->adjustLabelFor($options);
     $this->parts['{input}'] = Html::activeRadioList($this->model, $this->attribute, $items, $options);
     return $this;
 }
 public function run()
 {
     return Html::tag($this->directive, null, $this->options);
 }