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


PHP Widget::init方法代码示例

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


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

示例1: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!$this->header) {
         $this->header = "<h2>" . Inflector::camel2words($this->model->formName()) . " change log:</h2>";
     }
 }
开发者ID:cranky4,项目名称:change-log-behavior,代码行数:10,代码来源:ChangeLogList.php

示例2: init

 public function init()
 {
     parent::init();
     if (!$this->items) {
         throw new InvalidConfigException(\Yii::t('front', 'No required parameter given') . ' - items');
     }
 }
开发者ID:czechcamus,项目名称:dasport,代码行数:7,代码来源:ArrayOwlCarousel.php

示例3: init

 public function init()
 {
     parent::init();
     // Exception IF params -> languages not defined
     if (!isset(Yii::$app->params['languages'])) {
         throw new \yii\base\InvalidConfigException("You must define Yii::\$app->params['languages'] array");
     }
     // Widget Type
     if (!$this->widget_type) {
         $this->widget_type = 'classic';
     } else {
         $this->widget_type = $this->widget_type;
     }
     // Image Type
     if (!$this->image_type) {
         $this->image_type = 'classic';
     } else {
         $this->image_type = $this->image_type;
     }
     // Widget Type
     if (!$this->width) {
         $this->width = '24';
     } else {
         $this->width = $this->width;
     }
 }
开发者ID:Marostack,项目名称:Marostack,代码行数:26,代码来源:MultiLanguageWidget.php

示例4: init

 public function init()
 {
     parent::init();
     ob_start();
     $this->portletId = \Yii::$app->params['portlets'] + 1;
     \Yii::$app->params['portlets'] = $this->portletId;
 }
开发者ID:junctionaof,项目名称:thanagornfarm,代码行数:7,代码来源:Portlet.php

示例5: init

 public function init()
 {
     if (!$this->dateStop) {
         $this->dateStop = date('Y-m-d H:i:s');
     }
     return parent::init();
 }
开发者ID:pistol88,项目名称:yii2-order,代码行数:7,代码来源:ReportPaymentTypes.php

示例6: init

 public function init()
 {
     parent::init();
     if ($this->title === null) {
         $this->title = 'title';
     }
 }
开发者ID:funson86,项目名称:yii2-blog,代码行数:7,代码来源:RecentComments.php

示例7: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $view = Yii::$app->getView();
     $this->registerAssets();
     $view->registerJs($this->getJs(), View::POS_END);
 }
开发者ID:bsadnu,项目名称:yii2-googlecharts,代码行数:10,代码来源:PieChart.php

示例8: init

 public function init()
 {
     parent::init();
     $view = $this->getView();
     $widgetId = $this->id;
     if (isset($this->gridSettings['iconSet']) && $this->gridSettings['iconSet'] === 'fontAwesome') {
         $useFontAwesome = true;
     } else {
         $useFontAwesome = false;
     }
     $this->jsonSettings = (YII_DEBUG ? JSON_PRETTY_PRINT : 0) | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK;
     $script = "jQuery(\"#jqGrid-{$widgetId}\").jqGrid({$this->prepareGridSettings($this->gridSettings)})";
     if ($this->enablePager) {
         $script .= PHP_EOL . ".navGrid('#jqGrid-pager-{$widgetId}', {$this->preparePagerSettings($this->pagerSettings)})";
     }
     if ($this->enableFilterToolbar) {
         $script .= PHP_EOL . ".filterToolbar({$this->prepareToolbarSettings($this->filterToolbarSettings)})";
     }
     if ($this->enableColumnChooser) {
         $buttonOptions = ['caption' => '', 'title' => new JsExpression('jQuery.jgrid.col.caption'), 'buttonicon' => $useFontAwesome ? 'fa fa-lg fa-fw fa-calculator' : 'ui-icon-calculator', 'onClickButton' => $this->enableHiddenColumnsOptimization ? new JsExpression("function() {\n                        jQuery(this).jqGrid('columnChooser', {\n                            done: function(perm) {\n                                if(perm) {\n                                    this.jqGrid('remapColumns', perm, true);\n                                    this.trigger('reloadGrid');\n                                }\n                            }\n                        });\n                    }") : new JsExpression("function(){jQuery(this).jqGrid('columnChooser');}")];
         $buttonOptions = Json::encode($buttonOptions, $this->jsonSettings);
         $script .= PHP_EOL . ".navButtonAdd('#jqGrid-pager-{$widgetId}', {$buttonOptions})";
     }
     if ($this->enableXMLExport) {
         $buttonOptions = ['caption' => '', 'title' => 'Export to Excel XML', 'buttonicon' => $useFontAwesome ? 'fa fa-file-excel-o' : 'ui-icon-document', 'onClickButton' => new JsExpression("function(){jQuery.jgrid.XMLExport('{$widgetId}', 'ExcelXML.xml');}")];
         $buttonOptions = Json::encode($buttonOptions, $this->jsonSettings);
         $script .= PHP_EOL . ".navButtonAdd('#jqGrid-pager-{$widgetId}', {$buttonOptions})";
     }
     $view->registerJs($script, $view::POS_READY);
     WidgetAsset::register($view);
 }
开发者ID:apaoww,项目名称:yii2-jqgrid-widget,代码行数:31,代码来源:JqGridWidget.php

示例9: init

 public function init()
 {
     parent::init();
     if (!$this->rowViewPath) {
         $this->rowViewPath = '_row';
     }
 }
开发者ID:mitalcoi,项目名称:yii2-multi,代码行数:7,代码来源:MultiInput.php

示例10: init

 public function init()
 {
     parent::init();
     if (empty($this->title) || empty($this->num)) {
         throw new InvalidConfigException('SidePostTop config is error.');
     }
 }
开发者ID:jorry2008,项目名称:turen,代码行数:7,代码来源:SidePostTop.php

示例11: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     if (!isset($this->options['class'])) {
         Html::addCssClass($this->options, 'dropdown');
     }
 }
开发者ID:philippfrenzel,项目名称:yiiframework.com,代码行数:10,代码来源:DropdownList.php

示例12: init

 public function init()
 {
     parent::init();
     //        if(!$this->label || !is_array($this->config)){
     //            throw new Exception('缺少参数或参数缺失');
     //        }
 }
开发者ID:lurongze,项目名称:uii20160328,代码行数:7,代码来源:MulitinputWidget.php

示例13: init

 public function init()
 {
     parent::init();
     $this->_inputStr = '<div class="form-group">';
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
     } else {
         $this->_inputStr .= Html::label($this->name);
     }
     $this->_inputStr .= '<div id="' . Html::encode($this->name) . '" class="input-group date">';
     if ($this->hasModel()) {
         $value = Html::getAttributeValue($this->model, $this->attribute);
     } else {
         $value = $this->value;
     }
     if ($value !== null) {
         $value = Yii::$app->formatter->asDatetime($value);
     }
     $options = $this->options;
     $options['class'] = 'form-control';
     //$options['readonly'] = '';
     $options['value'] = $value;
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeTextInput($this->model, $this->attribute, $options);
     } else {
         $this->_inputStr .= Html::textInput($this->name, $this->value, $options);
     }
     $this->_inputStr .= '<span class="input-group-addon">
                                     <span class="glyphicon-calendar glyphicon"></span>
                                 </span>
                             </div>
                             </div>
                             ';
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:34,代码来源:BootstrapDatetimePicker.php

示例14: init

 public function init()
 {
     parent::init();
     if (empty($this->options)) {
         Html::addCssClass($this->options, ['horizontal-menu']);
     }
 }
开发者ID:prawee,项目名称:yii2-metroui,代码行数:7,代码来源:Menu.php

示例15: init

 public function init()
 {
     parent::init();
     if (empty($this->view)) {
         $this->view = (new \ReflectionClass($this))->getShortName();
     }
 }
开发者ID:quynhvv,项目名称:stepup,代码行数:7,代码来源:Tree.php


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