當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config::isInputWidget方法代碼示例

本文整理匯總了PHP中kartik\base\Config::isInputWidget方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::isInputWidget方法的具體用法?PHP Config::isInputWidget怎麽用?PHP Config::isInputWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kartik\base\Config的用法示例。


在下文中一共展示了Config::isInputWidget方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderFormAttribute

 /**
  * Renders each form attribute
  *
  * @param array $config the attribute config
  *
  * @return mixed
  * @throws \yii\base\InvalidConfigException
  */
 protected function renderFormAttribute($config)
 {
     if (empty($config['attribute'])) {
         return '';
     }
     $model = ArrayHelper::getValue($config, 'editModel', $this->model);
     if (!$model instanceof Model) {
         $model = $this->model;
     }
     $attr = ArrayHelper::getValue($config, 'updateAttr', $config['attribute']);
     $input = ArrayHelper::getValue($config, 'type', self::INPUT_TEXT);
     $fieldConfig = ArrayHelper::getValue($config, 'fieldConfig', []);
     $inputWidth = ArrayHelper::getValue($config, 'inputWidth', '');
     $container = ArrayHelper::getValue($config, 'inputContainer', []);
     if ($inputWidth != '') {
         Html::addCssStyle($container, "width: {$inputWidth}");
         // deprecated since v1.7.4
     }
     $template = ArrayHelper::getValue($fieldConfig, 'template', "{input}\n{error}\n{hint}");
     $row = Html::tag('div', $template, $container);
     if (static::hasGridCol($container)) {
         $row = '<div class="row">' . $row . '</div>';
     }
     $fieldConfig['template'] = $row;
     if (substr($input, 0, 8) == "\\kartik\\") {
         Config::validateInputWidget($input, 'as an input widget for DetailView edit mode');
     } elseif ($input !== self::INPUT_WIDGET && !in_array($input, self::$_inputsList)) {
         throw new InvalidConfigException("Invalid input type '{$input}' defined for the attribute '" . $config['attribute'] . "'.");
     }
     $options = ArrayHelper::getValue($config, 'options', []);
     $widgetOptions = ArrayHelper::getValue($config, 'widgetOptions', []);
     $class = ArrayHelper::remove($widgetOptions, 'class', '');
     if (!empty($config['options'])) {
         $widgetOptions['options'] = $config['options'];
     }
     if (Config::isInputWidget($input)) {
         $class = $input;
         return $this->_form->field($model, $attr, $fieldConfig)->widget($class, $widgetOptions);
     }
     if ($input === self::INPUT_WIDGET) {
         if ($class == '') {
             throw new InvalidConfigException("Widget class not defined in 'widgetOptions' for {$input}'.");
         }
         return $this->_form->field($model, $attr, $fieldConfig)->widget($class, $widgetOptions);
     }
     if (in_array($input, self::$_dropDownInputs)) {
         $items = ArrayHelper::getValue($config, 'items', []);
         return $this->_form->field($model, $attr, $fieldConfig)->{$input}($items, $options);
     }
     if ($input == self::INPUT_HTML5_INPUT) {
         $inputType = ArrayHelper::getValue($config, 'inputType', self::INPUT_TEXT);
         return $this->_form->field($model, $attr, $fieldConfig)->{$input}($inputType, $options);
     }
     return $this->_form->field($model, $attr, $fieldConfig)->{$input}($options);
 }
開發者ID:rumatakira,項目名稱:yii2-detail-view,代碼行數:63,代碼來源:DetailView.php

示例2: renderFormFields

 /**
  * Renders the editable form fields
  *
  * @return string
  */
 protected function renderFormFields()
 {
     echo $this->parseTemplate('templateBefore');
     echo Html::hiddenInput('hasEditable', 0) . "\n";
     if ($this->beforeInput !== null) {
         if (is_string($this->beforeInput)) {
             echo $this->beforeInput . "\n";
         } else {
             echo call_user_func($this->beforeInput, $this->_form, $this) . "\n";
         }
     }
     if ($this->inputType === self::INPUT_HTML5_INPUT) {
         echo $this->renderHtml5Input() . "\n";
     } elseif ($this->inputType === self::INPUT_WIDGET) {
         echo $this->renderWidget($this->widgetClass) . "\n";
     } elseif (Config::isHtmlInput($this->inputType)) {
         echo $this->renderInput() . "\n";
     } elseif (Config::isInputWidget($this->inputType)) {
         echo $this->renderWidget($this->inputType) . "\n";
     }
     if ($this->afterInput !== null) {
         if (is_string($this->afterInput)) {
             echo $this->afterInput . "\n";
         } else {
             echo call_user_func($this->afterInput, $this->_form, $this) . "\n";
         }
     }
     echo $this->parseTemplate('templateAfter');
 }
開發者ID:cindyming,項目名稱:yii-advance,代碼行數:34,代碼來源:Editable.php

示例3: renderFormFields

 /**
  * Renders the editable form fields
  *
  * @return string
  */
 protected function renderFormFields()
 {
     echo $this->parseTemplate('templateBefore');
     echo Html::hiddenInput('hasEditable', 0) . "\n";
     $before = $this->beforeInput;
     $after = $this->afterInput;
     if ($before !== null && is_string($before) || is_callable($before)) {
         echo (is_callable($before) ? call_user_func($before, $this->_form, $this) : $before) . "\n";
     }
     if ($this->inputType === self::INPUT_HTML5_INPUT) {
         echo $this->renderHtml5Input() . "\n";
     } elseif ($this->inputType === self::INPUT_WIDGET) {
         echo $this->renderWidget($this->widgetClass) . "\n";
     } elseif (Config::isHtmlInput($this->inputType)) {
         echo $this->renderInput() . "\n";
     } elseif (Config::isInputWidget($this->inputType)) {
         echo $this->renderWidget($this->inputType) . "\n";
     }
     if ($after !== null && is_string($after) || is_callable($after)) {
         echo (is_callable($after) ? call_user_func($after, $this->_form, $this) : $after) . "\n";
     }
     echo $this->parseTemplate('templateAfter');
 }
開發者ID:kartik-v,項目名稱:yii2-editable,代碼行數:28,代碼來源:Editable.php

示例4: renderFormAttribute

 /**
  * Renders each form attribute
  *
  * @param array $config the attribute config
  *
  * @return mixed
  * @throws \yii\base\InvalidConfigException
  */
 protected function renderFormAttribute($config)
 {
     if (empty($config['attribute'])) {
         return '';
     }
     $attr = ArrayHelper::getValue($config, 'updateAttr', $config['attribute']);
     $input = ArrayHelper::getValue($config, 'type', self::INPUT_TEXT);
     $fieldConfig = ArrayHelper::getValue($config, 'fieldConfig', []);
     $inputWidth = ArrayHelper::getValue($config, 'inputWidth', '');
     if ($inputWidth != '') {
         $template = ArrayHelper::getValue($fieldConfig, 'template', "{input}\n{error}\n{hint}");
         $fieldConfig['template'] = "<div style='width:{$inputWidth};'>{$template}</div>";
     }
     if (substr($input, 0, 8) == "\\kartik\\") {
         Config::validateInputWidget($input, 'as an input widget for DetailView edit mode');
     } elseif ($input !== self::INPUT_WIDGET && !in_array($input, self::$_inputsList)) {
         throw new InvalidConfigException("Invalid input type '{$input}' defined for the attribute '" . $config['attribute'] . "'.");
     }
     $options = ArrayHelper::getValue($config, 'options', []);
     $widgetOptions = ArrayHelper::getValue($config, 'widgetOptions', []);
     $class = ArrayHelper::remove($widgetOptions, 'class', '');
     if (!empty($config['options'])) {
         $widgetOptions['options'] = $config['options'];
     }
     if (Config::isInputWidget($input)) {
         $class = $input;
         return $this->_form->field($this->model, $attr, $fieldConfig)->widget($class, $widgetOptions);
     }
     if ($input === self::INPUT_WIDGET) {
         if ($class == '') {
             throw new InvalidConfigException("Widget class not defined in 'widgetOptions' for {$input}'.");
         }
         return $this->_form->field($this->model, $attr, $fieldConfig)->widget($class, $widgetOptions);
     }
     if (in_array($input, self::$_dropDownInputs)) {
         $items = ArrayHelper::getValue($config, 'items', []);
         return $this->_form->field($this->model, $attr, $fieldConfig)->{$input}($items, $options);
     }
     if ($input == self::INPUT_HTML5_INPUT) {
         $inputType = ArrayHelper::getValue($config, 'inputType', self::INPUT_TEXT);
         return $this->_form->field($this->model, $attr, $fieldConfig)->{$input}($inputType, $options);
     }
     return $this->_form->field($this->model, $attr, $fieldConfig)->{$input}($options);
 }
開發者ID:gpis88ce,項目名稱:Gpis88ce,代碼行數:52,代碼來源:DetailView.php

示例5: renderFormFields

 /**
  * Renders the editable form fields
  *
  * @return string
  */
 protected function renderFormFields()
 {
     $out = Html::hiddenInput('hasEditable', 0) . "\n";
     if ($this->beforeInput !== null) {
         if (is_string($this->beforeInput)) {
             $out .= $this->beforeInput . "\n";
         } else {
             $out .= call_user_func($this->beforeInput, $this->_form, $this) . "\n";
         }
     }
     if ($this->inputType === self::INPUT_HTML5_INPUT) {
         $out .= $this->renderHtml5Input() . "\n";
     } elseif ($this->inputType === self::INPUT_WIDGET) {
         $out .= $this->renderWidget($this->widgetClass) . "\n";
     } elseif (Config::isHtmlInput($this->inputType)) {
         $out .= $this->renderInput() . "\n";
     } elseif (Config::isInputWidget($this->inputType)) {
         $out .= $this->renderWidget($this->inputType) . "\n";
     }
     if ($this->afterInput !== null) {
         if (is_string($this->afterInput)) {
             $out .= $this->afterInput . "\n";
         } else {
             $out .= call_user_func($this->afterInput, $this->_form, $this) . "\n";
         }
     }
     return $out;
 }
開發者ID:jplagahit,項目名稱:brdsdev,代碼行數:33,代碼來源:Editable.php

示例6: renderFilterCellContent

 /**
  * Renders filter inputs based on the `filterType`
  *
  * @return string
  */
 protected function renderFilterCellContent()
 {
     $content = parent::renderFilterCellContent();
     $chkType = !empty($this->filterType) && $this->filterType !== GridView::FILTER_CHECKBOX && $this->filterType !== GridView::FILTER_RADIO && !class_exists($this->filterType);
     if ($this->filter === false || empty($this->filterType) || $content === $this->grid->emptyCell || $chkType) {
         return $content;
     }
     $widgetClass = $this->filterType;
     $options = ['model' => $this->grid->filterModel, 'attribute' => $this->attribute, 'options' => $this->filterInputOptions];
     if (is_array($this->filter)) {
         if (Config::isInputWidget($this->filterType) && $this->grid->pjax) {
             $options['pjaxContainerId'] = $this->grid->pjaxSettings['options']['id'];
         }
         if ($this->filterType === GridView::FILTER_SELECT2 || $this->filterType === GridView::FILTER_TYPEAHEAD) {
             $options['data'] = $this->filter;
         }
         if ($this->filterType === GridView::FILTER_RADIO) {
             return Html::activeRadioList($this->grid->filterModel, $this->attribute, $this->filter, $this->filterInputOptions);
         }
     }
     if ($this->filterType === GridView::FILTER_CHECKBOX) {
         return Html::activeCheckbox($this->grid->filterModel, $this->attribute, $this->filterInputOptions);
     }
     $options = ArrayHelper::merge($this->filterWidgetOptions, $options);
     /** @var \kartik\base\Widget $widgetClass */
     return $widgetClass::widget($options);
 }
開發者ID:Bladefidz,項目名稱:ocfa_yii,代碼行數:32,代碼來源:DataColumn.php


注:本文中的kartik\base\Config::isInputWidget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。