当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::dropDownList方法代码示例

本文整理汇总了PHP中yii\helpers\Html::dropDownList方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::dropDownList方法的具体用法?PHP Html::dropDownList怎么用?PHP Html::dropDownList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::dropDownList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $this->registerPlugin('select2');
     Html::addCssClass($this->options, 'form-control');
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::dropDownList($this->name, $this->selection, $this->items, $this->options);
     }
 }
开发者ID:p0vidl0,项目名称:yii2-select2,代码行数:10,代码来源:Select2.php

示例2: run

 /**
  * Executes the widget.
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->data, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $this->data, $this->options);
     }
     MultiSelectAsset::register($this->view);
     $this->registerPlugin('multiSelect');
 }
开发者ID:luobenyu,项目名称:yii2-metronic,代码行数:13,代码来源:MultiSelect.php

示例3: renderDataCellContent

 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if (isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] .= 'editableCell form-control';
     } else {
         $this->htmlOptions['class'] = 'editableCell form-control';
     }
     // We need to number the submit attributes because data attribute is not case sensitive
     $this->htmlOptions['data-submit-attributes'] = implode(',', $this->submitAttributes);
     $i = 0;
     foreach ($this->submitAttributes as $attribute) {
         $this->htmlOptions['data-attribute' . $i] = $model[$attribute];
         $i++;
     }
     $options = [];
     if (is_array($this->dropDownOptions)) {
         $options = $this->dropDownOptions;
     } else {
         $options = $model[$this->dropDownOptions];
     }
     $inputName = is_array($model) ? $this->attribute : Html::getInputName($model, $this->attribute);
     $readonly = $this->readonly;
     if (!is_bool($readonly)) {
         $readonly = call_user_func($this->readonly, $model, $key, $index, $this);
     }
     if ($readonly) {
         if (isset($options[$model[$this->attribute]])) {
             return $options[$model[$this->attribute]];
         }
         return $model[$this->attribute];
     }
     return Html::dropDownList($inputName, $model[$this->attribute], $options, $this->htmlOptions);
 }
开发者ID:SimonBaeumer,项目名称:humhub,代码行数:36,代码来源:DropDownGridColumn.php

示例4: run

    public function run()
    {
        $view = $this->getView();
        Select2Asset::register($view);
        if ($this->value === '') {
            $this->value = [];
        }
        if (!is_array($this->value)) {
            $this->value[$this->value] = $this->value;
        }
        $tags = json_encode($this->tags);
        echo Html::dropDownList($this->name, $this->value, $this->tags, ['class' => 'form-control', 'multiple' => true, 'id' => $this->options['id']]);
        $script = <<<SCRIPT
        \$("#{$this->options['id']}").select2({
            placeholder: "{$this->placeholder}",
            tags: {$tags},

        })

SCRIPT;
        if ($this->onChange) {
            $script .= '.on("change", function(e){ $.ajax("' . $this->onChange . '&" + $("#' . $this->options['id'] . '").serialize());})';
        }
        if ($this->disabled) {
            $script .= '.prop("disabled", true)';
        }
        $script .= ';';
        $view = $this->getView();
        $view->registerJs($script);
    }
开发者ID:enigmatix,项目名称:yii2-widgets,代码行数:30,代码来源:Tags.php

示例5: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $timeZones = [];
     $timeZonesOutput = [];
     $now = new \DateTime('now', new \DateTimeZone('UTC'));
     foreach (\DateTimeZone::listIdentifiers(\DateTimeZone::ALL) as $timeZone) {
         $now->setTimezone(new \DateTimeZone($timeZone));
         $timeZones[] = [$now->format('P'), $timeZone];
     }
     if ($this->sortBy == static::SORT_OFFSET) {
         array_multisort($timeZones);
     }
     foreach ($timeZones as $timeZone) {
         $content = preg_replace_callback("/{\\w+}/", function ($matches) use($timeZone) {
             switch ($matches[0]) {
                 case '{name}':
                     return $timeZone[1];
                 case '{offset}':
                     return $timeZone[0];
                 default:
                     return $matches[0];
             }
         }, $this->template);
         $timeZonesOutput[$timeZone[1]] = $content;
     }
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $timeZonesOutput, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->selection, $timeZonesOutput, $this->options);
     }
 }
开发者ID:yii-dream-team,项目名称:yii2-timezone-picker,代码行数:34,代码来源:Picker.php

示例6: run

 /**
  * Renders the widget.
  */
 public function run()
 {
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->_getItems(), $this->options);
     } else {
         return Html::dropDownList($this->name, $this->value, $this->_getItems(), $this->options);
     }
 }
开发者ID:AsiaWebSolution,项目名称:yii2GeneralVendor,代码行数:11,代码来源:YearSelectbox.php

示例7: renderPageSize

 public function renderPageSize()
 {
     if (!$this->paginationPageSize || !count($this->paginationPageSize)) {
         return '';
     }
     $content = Html::dropDownList('', self::getPaginationSize(), array_combine(array_values($this->paginationPageSize), $this->paginationPageSize), ['class' => 'pagination-size form-control']);
     return $content;
 }
开发者ID:sanchezzzhak,项目名称:kak-grid,代码行数:8,代码来源:GridView.php

示例8: renderDataCellContent

 /**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     $attribute = $this->attribute;
     $name = Html::getInputName($model, $attribute);
     $value = $model->{$attribute};
     $options = ArrayHelper::merge(['class' => $this->classPrefix . '-' . $attribute, 'data-id' => $key], $this->options);
     return Html::dropDownList($name, $value, $model::$enum_category, $options);
 }
开发者ID:gerpayt,项目名称:yii2-select-column,代码行数:11,代码来源:SelectColumn.php

示例9: renderDropDown

 /**
  * Render dropdown list
  */
 public function renderDropDown()
 {
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
 }
开发者ID:yii2mod,项目名称:yii2-selectize,代码行数:11,代码来源:Selectize.php

示例10: renderButtons

 /**
  * @return string
  */
 protected function renderButtons()
 {
     $buttons = [self::ADD_ACTION => Html::button(Icon::show('plus') . ' ' . Yii::t('app', 'Add selected to:'), ['class' => isset($this->htmlOptions['add-class']) ? $this->htmlOptions['add-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::ADD_ACTION]), self::MOVE_ACTION => Html::button(Icon::show('arrows') . ' ' . Yii::t('app', 'Move selected to:'), ['class' => isset($this->htmlOptions['move-class']) ? $this->htmlOptions['move-class'] : 'btn btn-default', 'disabled' => 'disabled', 'data-mc-action' => self::MOVE_ACTION])];
     $group = '';
     foreach ($buttons as $id => $button) {
         $group .= Html::tag('div', Html::tag('div', $button . "\n\t" . Html::tag('div', Html::dropDownList(null, null, static::$categories, ['prompt' => Yii::t('app', 'Select category'), 'class' => 'form-control', 'id' => $id]), ['class' => 'input-group']), ['class' => 'btn-group']), ['class' => 'col-xs-12 col-sm-6']);
     }
     return Html::tag('div', $group, ['class' => 'row m-bottom-10']);
 }
开发者ID:lzpfmh,项目名称:dotplant2,代码行数:12,代码来源:CategoryMovementsButtons.php

示例11: run

 public function run()
 {
     echo Html::beginForm(Url::to([$this->actionUrl]), 'post', []);
     if (!empty($this->returnUrl)) {
         echo Html::hiddenInput('returnUrl', $this->returnUrl);
     }
     echo Html::dropDownList('language', Yii::$app->language, Yii::$app->czaHelper->getEnabledLangs(), ['id' => $this->htmlId(), 'onchange' => 'this.form.submit()']);
     echo Html::endForm();
 }
开发者ID:bennybi,项目名称:yii2-cza-base,代码行数:9,代码来源:LanguageSelectBox.php

示例12: renderPageDropDownList

 protected function renderPageDropDownList()
 {
     $pageSizeList = [];
     foreach ($this->pageSizeList as $value) {
         $pageSizeList[$value] = $value;
     }
     //$linkurl =  $this->pagination->createUrl($page);
     return Html::dropDownList($this->pagination->pageSizeParam, $this->pagination->getPageSize(), $pageSizeList, $this->dropDownOptions);
 }
开发者ID:heartshare,项目名称:yii2-widget-linkpager,代码行数:9,代码来源:LinkPager.php

示例13: run

 public function run()
 {
     $this->registerJqueryPlugin('material_select');
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
 }
开发者ID:tuyakhov,项目名称:yii2-materialize,代码行数:9,代码来源:Select.php

示例14: run

 /**
  * Render chosen select
  * @return string|void
  */
 public function run()
 {
     if ($this->hasModel()) {
         echo Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         echo Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
     $this->registerAssets();
 }
开发者ID:SoftCommerce,项目名称:yii2-chosen-select,代码行数:13,代码来源:ChosenSelect.php

示例15: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->registerClientScript();
     if ($this->hasModel()) {
         return Html::activeDropDownList($this->model, $this->attribute, $this->items, $this->options);
     } else {
         return Html::dropDownList($this->name, $this->value, $this->items, $this->options);
     }
 }
开发者ID:rychkov-evgeniy,项目名称:yii2-base,代码行数:12,代码来源:Widget.php


注:本文中的yii\helpers\Html::dropDownList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。