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


PHP Select2::init方法代码示例

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


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

示例1: init

 /**
  *
  */
 public function init()
 {
     if (empty($this->parentName)) {
         throw new InvalidParamException('RelativeSelect2 $parentName must be set!');
     }
     if (empty($this->url)) {
         throw new InvalidParamException('RelativeSelect2 $url must be set!');
     }
     if ($this->parentModel instanceof Model) {
         $this->options['data']['select2-parent-name'] = Html::getInputName($this->parentModel, $this->parentName);
     } else {
         $this->options['data']['select2-parent-name'] = $this->hasModel() ? Html::getInputName($this->model, $this->parentName) : $this->parentName;
     }
     if (is_array($this->url)) {
         $this->url = Url::to($this->url);
     }
     $this->options['data']['select2-url'] = $this->url;
     if (!empty($this->model) && isset($this->model->{$this->attribute})) {
         if (is_array($this->model->{$this->attribute})) {
             $this->options['data']['select2-selected-items'] = implode(',', $this->model->{$this->attribute});
         } else {
             $this->options['data']['select2-selected-items'] = $this->model->{$this->attribute};
         }
     } else {
         $this->options['data']['select2-selected-items'] = $this->value;
     }
     parent::init();
     RelativeSelect2Asset::register($this->getView());
 }
开发者ID:platx,项目名称:yii2-relative-select2,代码行数:32,代码来源:RelativeSelect2.php

示例2: init

 public function init()
 {
     $this->setDefaultOptions();
     if ($this->getSelect2Type() == 'ajax') {
         $this->setAjaxOptions();
     }
     parent::init();
 }
开发者ID:nagser,项目名称:base,代码行数:8,代码来源:Select2.php

示例3: init

 public function init()
 {
     $allValuesTmp = $this->view->params[$this->name . "_all"];
     foreach ($allValuesTmp as $v) {
         $allValuesTmp2[$v] = $v;
     }
     $selectedValuesTmp = $this->view->params[$this->name];
     if ($selectedValuesTmp) {
         foreach ($selectedValuesTmp as $v) {
             $selectedValuesTmp2[$v] = $v;
         }
     } else {
         $selectedValuesTmp2 = null;
     }
     $this->data = $allValuesTmp2;
     $this->value = $selectedValuesTmp2;
     $this->options = ['multiple' => true, 'placeholder' => $this->initialText];
     parent::init();
 }
开发者ID:Polymedia,项目名称:BI-Platform-v3,代码行数:19,代码来源:FilterWidget.php


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