當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。