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


PHP Html::addCssClass方法代码示例

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


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

示例1: run

 public function run()
 {
     $this->clientOptions['treeViewId'] = $this->treeViewId;
     $this->registerWidget();
     \yii\helpers\Html::addCssClass($this->options, 'execut-tree-filter-input');
     $inputOptions = $this->inputOptions;
     Html::addCssClass($inputOptions, 'form-control');
     $inputOptions['autocomplete'] = 'off';
     echo $this->_renderContainer(Html::input('text', 'search', null, $inputOptions) . '<span class="close" title="Clear search results">×</span>');
 }
开发者ID:loveorigami,项目名称:yii2-widget-bootstraptreeview,代码行数:10,代码来源:TreeFilterInput.php

示例2: renderButton

 /**
  * Generates the button dropdown.
  * @return string the rendering result.
  */
 protected function renderButton()
 {
     // Html::addCssClass($this->options, ['widget' => 'btn']);
     $label = $this->label;
     $options = $this->options;
     if (!isset($options['href'])) {
         $options['href'] = '#';
     }
     Html::addCssClass($options, ['toggle' => 'dropdown-toggle']);
     $options['data-toggle'] = 'dropdown';
     return Html::tag($this->tagName, $label, $options) . "\n";
 }
开发者ID:roboapp,项目名称:admin,代码行数:16,代码来源:ButtonContextMenu.php

示例3: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     parent::run();
     // TODO: Change the autogenerated stub
     if (!empty($this->country)) {
         $class = 'flag-icon flag-icon-' . $this->country;
         Html::addCssClass($this->options, $class);
         if ($this->squared) {
             Html::addCssClass($this->options, 'flag-icon-squared');
         }
         $this->register();
         echo Html::beginTag('span', $this->options);
         echo Html::endTag('span');
     }
 }
开发者ID:modernkernel,项目名称:yii2-flag-icon-css,代码行数:18,代码来源:Flag.php

示例4: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     foreach ($this->items as &$item) {
         // icon ?
         if (isset($item['icon'])) {
             $icon = FA::icon($item['icon'] . ' fw');
             $item['label'] = trim($icon . ' ' . ArrayHelper::getValue($item, 'label', ''));
             $item['encode'] = false;
             unset($item['icon']);
         }
         // active ?
         if (isset($item['active'])) {
             $active = $item['active'];
             if ($active instanceof \Closure) {
                 $active = call_user_func($active, $this->getView()->getContext());
             }
             if ($active) {
                 Html::addCssClass($item['options'], 'active');
             }
             unset($item['active']);
         }
     }
     return parent::run();
 }
开发者ID:iutbay,项目名称:yii2-bootstrap,代码行数:27,代码来源:Dropdown.php

示例5: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     //register assets
     $this->registerPlugin('button');
     AjaxToggleButtonAsset::register($this->getView());
     //prepare ajax params
     $params = [];
     foreach ($this->model->primaryKey() as $pkCol) {
         $params[$pkCol] = $this->model->{$pkCol};
     }
     Html::addCssClass($this->options, 'widget-ajax-button');
     $this->options['data']['current-value'] = $this->model->{$this->booleanAttribute};
     $this->options['data']['pjax'] = 0;
     $this->options['data']['boolean-format'] = $this->booleanFormat;
     $this->options['data']['ajax-params'] = $params;
     $this->options['data']['ajax-method'] = $this->ajaxMethod;
     return Html::a($this->createLabel(), $this->ajaxUrl, $this->options);
 }
开发者ID:highestgoodlikewater,项目名称:yii2-toolbox,代码行数:21,代码来源:AjaxToggleButton.php

示例6: isChildActive

 /**
  * Check to see if a child item is active optionally activating the parent.
  * @param array $items @see items
  * @param boolean $active should the parent be active too
  * @return array @see items
  */
 protected function isChildActive($items, &$active)
 {
     foreach ($items as $i => $child) {
         if (ArrayHelper::remove($items[$i], 'active', false) || $this->isItemActive($child)) {
             Html::addCssClass($items[$i]['options'], 'active');
             if ($this->activateParents) {
                 $active = true;
             }
         }
     }
     return $items;
 }
开发者ID:su-xiaolin,项目名称:ICShop-Yii,代码行数:18,代码来源:Nav.php

示例7: addClass

 public function addClass($class)
 {
     BaseHtml::addCssClass($this->options, $class);
     return $this;
 }
开发者ID:carono,项目名称:yii2-components,代码行数:5,代码来源:ActiveField.php

示例8: square

 /**
  * Creates a squared flag icon
  * @return self
  */
 public function square()
 {
     Html::addCssClass($this->options, 'flag-icon-squared');
     return $this;
 }
开发者ID:p2made,项目名称:yii2-p2y2-things,代码行数:9,代码来源:Flag.php

示例9: getFilterError

 protected function getFilterError()
 {
     $model = $this->grid->filterModel;
     if ($model->hasErrors($this->attribute)) {
         Html::addCssClass($this->filterOptions, 'has-error');
         return ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
     } else {
         return '';
     }
 }
开发者ID:bruno-melo,项目名称:components,代码行数:10,代码来源:DataColumn.php

示例10: renderStatisticContent

 /**
  * Return statistic content
  * @return string
  */
 public function renderStatisticContent()
 {
     $content = '';
     if (!empty($this->statisticColumns) && is_array($this->statisticColumns)) {
         $numberColumn = count($this->statisticColumns);
         foreach ($this->statisticColumns as $column) {
             $header = ArrayHelper::getValue($column, 'header', 'Orders');
             $time = ArrayHelper::getValue($column, 'time', 'Annual');
             $percent = ArrayHelper::getValue($column, 'percent', '85%');
             $totalStatistic = ArrayHelper::getValue($column, 'totalStatistic', '40 886,200');
             $smallHeader = ArrayHelper::getValue($column, 'smallHeader', 'New orders');
             // Options element in statistic
             $headerOptions = ArrayHelper::getValue($column, 'headerOptions', []);
             $timeOptions = ArrayHelper::getValue($column, 'timeOptions', []);
             $percentOptions = ArrayHelper::getValue($column, 'percentOptions', []);
             $totalStatisticOptions = ArrayHelper::getValue($column, 'totalStatisticOptions', []);
             $smallHeaderOptions = ArrayHelper::getValue($column, 'smallHeaderOptions', []);
             // Replace input
             if ($header !== false) {
                 Html::addCssClass($headerOptions, '');
                 $header = Html::tag('h5', $header, $headerOptions);
             }
             if ($time !== false) {
                 if (empty($timeOptions['class'])) {
                     $timeOptions['class'] = 'label-success';
                 }
                 Html::addCssClass($timeOptions, 'label pull-right');
                 $time = Html::tag('span', $time, $timeOptions);
             }
             if ($percent !== false) {
                 Html::addCssClass($percentOptions, 'stat-percent font-bold text-success');
                 $percent = Html::tag('div', $percent . ' <i class="fa fa-bolt"></i>', $percentOptions);
             }
             if ($totalStatistic !== false) {
                 Html::addCssClass($totalStatisticOptions, 'no-margins');
                 $totalStatistic = Html::tag('h1', $totalStatistic, $totalStatisticOptions);
             }
             if ($smallHeader !== false) {
                 Html::addCssClass($smallHeaderOptions, '');
                 $smallHeader = Html::tag('small', $smallHeader, $smallHeaderOptions);
             }
             $statistic = strtr($this->statisticTemplate, ['{header}' => $header, '{time}' => $time, '{totalStatistic}' => $totalStatistic, '{percent}' => $percent, '{smallHeader}' => $smallHeader]);
             $content .= Html::tag('div', $statistic, ['class' => 'col-lg-' . round(12 / $numberColumn)]);
         }
     }
     return $content;
 }
开发者ID:raoulgargano,项目名称:yii2-ecommerce,代码行数:51,代码来源:Ecommerce.php

示例11: renderItems

 /**
  * Renders menu items.
  *
  * @param array $items the menu items to be rendered
  * @param array $options the container HTML attributes
  * @return string the rendering result.
  * @throws InvalidConfigException if the label option is not specified in one of the items.
  */
 protected function renderItems($items, $options = [])
 {
     $lines = [];
     foreach ($items as $i => $item) {
         if (isset($item['visible']) && !$item['visible']) {
             unset($items[$i]);
             continue;
         }
         if (is_string($item)) {
             $lines[] = $item;
             continue;
         }
         if (!array_key_exists('label', $item)) {
             throw new InvalidConfigException("The 'label' option is required.");
         }
         $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
         $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
         $itemOptions = ArrayHelper::getValue($item, 'options', []);
         $icon = ArrayHelper::getValue($item, 'icon', '');
         $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
         $linkOptions['tabindex'] = '-1';
         $url = array_key_exists('url', $item) ? $item['url'] : null;
         if (!empty($icon)) {
             $icon = Html::tag('i', '', ['class' => $icon]);
         }
         if (empty($item['items'])) {
             if ($url === null) {
                 $content = $label;
                 Html::addCssClass($itemOptions, 'dropdown-header');
             } else {
                 $content = Html::a($icon . $label, $url, $linkOptions);
             }
         } else {
             $submenuOptions = $options;
             unset($submenuOptions['id']);
             $content = Html::a($label, $url === null ? '#' : $url, $linkOptions) . $this->renderItems($item['items'], $submenuOptions);
             Html::addCssClass($itemOptions, 'dropdown-submenu');
         }
         $lines[] = Html::tag('li', $content, $itemOptions);
     }
     return Html::tag('ul', implode("\n", $lines), $options);
 }
开发者ID:peang,项目名称:components,代码行数:50,代码来源:SidebarDropdownWidget.php

示例12: initOptions

 /**
  * Initializes the widget options.
  * This method sets the default values for various options.
  */
 protected function initOptions()
 {
     Html::addCssClass($this->options, ['alert', 'fade', 'in']);
     if ($this->closeButton !== false) {
         $this->closeButton = array_merge(['data-dismiss' => 'alert', 'aria-hidden' => 'true', 'class' => 'close'], $this->closeButton);
     }
 }
开发者ID:Bright-Tech,项目名称:Yii2-Ace-Admin,代码行数:11,代码来源:Alert.php

示例13: renderItem

 /**
  * Renders single item.
  * @param array $item item configuration.
  * @return string rendered HTML
  */
 protected function renderItem($item)
 {
     if (isset($item[0])) {
         $url = $item;
         $options = [];
     } else {
         $url = $item['url'];
         $options = $item;
         unset($options['url']);
     }
     // label :
     if (isset($options['label'])) {
         $label = $options['label'];
         unset($options['label']);
     } else {
         $label = $this->detectLabel($url);
     }
     if (isset($options['encode'])) {
         $encodeLabel = $options['encode'];
         unset($options['encode']);
     } else {
         $encodeLabel = $this->encodeLabels;
     }
     if ($encodeLabel) {
         $label = Html::encode($label);
     }
     // icon :
     if (isset($options['icon'])) {
         $icon = $options['icon'];
         unset($options['icon']);
     } else {
         $icon = $this->detectIcon($url);
     }
     if ($icon) {
         $label = Html::icon($icon) . ' ' . $label;
     }
     // CSS class :
     if (isset($options['class'])) {
         Html::addCssClass($options, ['widget' => 'btn']);
     } else {
         $options['class'] = ['btn', $this->detectClass($url)];
     }
     if (!isset($options['data'])) {
         $options['data'] = $this->detectData($url);
     }
     return Html::a($label, $url, $options);
 }
开发者ID:ASP96,项目名称:admin,代码行数:52,代码来源:ButtonContextMenu.php

示例14: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     //register assets
     $this->registerPlugin('button');
     AjaxToggleButtonAsset::register($this->getView());
     //prepare ajax params
     $params = [];
     foreach ($this->model->primaryKey() as $pkCol) {
         $params[$pkCol] = $this->model->{$pkCol};
     }
     Html::addCssClass($this->options, 'widget-ajax-button');
     if ($this->model->{$this->booleanAttribute}) {
         Html::removeCssClass($this->options, $this->buttonClassOff);
         Html::addCssClass($this->options, $this->buttonClassOn);
     } else {
         Html::removeCssClass($this->options, $this->buttonClassOn);
         Html::addCssClass($this->options, $this->buttonClassOff);
     }
     $this->options['data']['current-value'] = $this->model->{$this->booleanAttribute};
     $this->options['data']['pjax'] = 0;
     $this->options['data']['boolean-format'] = $this->booleanFormat;
     $this->options['data']['ajax-params'] = $params;
     $this->options['data']['ajax-method'] = $this->ajaxMethod;
     $this->options['data']['event-success'] = $this->jsEventSuccess;
     $this->options['data']['event-error'] = $this->jsEventError;
     $this->options['data']['class-on'] = $this->buttonClassOn;
     $this->options['data']['class-off'] = $this->buttonClassOff;
     return Html::a($this->createLabel(), $this->ajaxUrl, $this->options);
 }
开发者ID:asinfotrack,项目名称:yii2-toolbox,代码行数:32,代码来源:AjaxToggleButton.php

示例15: icon

 /**
  * @return self
  */
 public function icon()
 {
     Html::removeCssClass($this->options, self::BTN_BLOCK);
     Html::removeCssClass($this->options, self::BTN_SOCIAL);
     Html::addCssClass($this->options, self::BTN_SOCIAL_ICON);
     $this->caption = $this->serviceIcon;
     return $this;
 }
开发者ID:p2made,项目名称:yii2-p2y2-things,代码行数:11,代码来源:SocialButton.php


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