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


PHP Html::addCssClass方法代码示例

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


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

示例1: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, ['widget' => 'info-box']);
     $iconOptions = ['class' => 'info-box-icon'];
     if ($this->type === self::COLORED_ICON) {
         Html::addCssClass($iconOptions, 'bg-' . $this->color);
     } else {
         Html::addCssClass($this->options, 'bg-' . $this->color);
     }
     echo Html::beginTag('div', $this->options);
     echo Html::tag('span', FA::icon($this->icon), $iconOptions);
     echo '<div class="info-box-content">';
     if (!empty($this->contents)) {
         foreach ($this->contents as $content) {
             if (is_array($content)) {
                 $type = ArrayHelper::getValue($content, 'type', 'text');
                 $text = ArrayHelper::getValue($content, 'text', '');
                 if (in_array($type, ['text', 'number'])) {
                     echo Html::tag('span', $text, ['class' => 'info-box-' . $type]);
                 } elseif ($type == 'progress') {
                     $value = ArrayHelper::getValue($content, 'value', $text);
                     echo '<div class="progress">';
                     echo Html::tag('div', '', ['class' => 'progress-bar', 'style' => ['width' => $value . '%']]);
                     echo '</div>';
                 } else {
                     echo Html::tag('span', $text, ['class' => $type]);
                 }
             } else {
                 echo $content;
             }
         }
     }
 }
开发者ID:WiconWang,项目名称:CS-Iris,代码行数:37,代码来源:InfoBox.php

示例2: fLabel

 /**
  * Generates a label.
  *
  * @param string $content the label content
  * @param string $type the label type - default is empty
  *  - is one of [[self::TYPE_SECONDARY]], [[self::TYPE_SUCCESS]], [[self::TYPE_WARNING]], [[self::TYPE_ALERT]]
  * @param string $border the border type - defaults is empty
  *  - is one of [[self::BORDER_RADIUS]], [[self::BORDER_ROUND]]
  * @param array $options html options for the label container
  * @param string $tag the label container tag - defaults to 'span'
  *
  * Example(s):
  * ~~~
  * echo Html::fLabel('Regular');
  * echo Html::fLabel('Primary', Html::TYPE_PRIMARY);
  * echo Html::fLabel('Success round', Html::TYPE_SUCCESS, Html::BORDER_ROUND);
  * ~~~
  *
  * @see http://getbootstrap.com/components/#labels
  */
 public static function fLabel($content, $type = '', $border = '', $options = [], $tag = 'span')
 {
     Html::addCssClass($options, 'label');
     Html::addCssClass($options, $type);
     Html::addCssClass($options, $border);
     return static::tag($tag, $content, $options);
 }
开发者ID:am1rb,项目名称:yii2-foundation,代码行数:27,代码来源:Html.php

示例3: run

 public function run()
 {
     AdminlteAsset::register($this->getView());
     Html::addCssClass($this->options, ['widget' => 'progress']);
     if ($this->vertical) {
         Html::addCssClass($this->options, 'vertical');
     }
     if (!empty($this->size)) {
         Html::addCssClass($this->options, $this->size);
     }
     $barOptions = ['class' => 'progress-bar'];
     if (!empty($this->type)) {
         Html::addCssClass($barOptions, 'progress-bar-' . $this->type);
     }
     if ($this->striped) {
         Html::addCssClass($barOptions, 'progress-bar-striped');
     }
     $barOptions['style']['width'] = $this->value . '%';
     if (empty($this->text)) {
         $text = '';
     } else {
         $text = Html::tag('span', $text, ['class' => 'sr-only']);
     }
     return Html::tag('div', Html::tag('div', $text, $barOptions), $this->options);
 }
开发者ID:WiconWang,项目名称:CS-Iris,代码行数:25,代码来源:Progress.php

示例4: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, ['widget' => 'box']);
     if ($this->solid) {
         Html::addCssClass($this->options, 'box-solid');
         if ($this->variant === null) {
             Html::addCssClass($this->options, 'box-default');
         }
     }
     if ($this->variant !== null) {
         Html::addCssClass($this->options, 'box-' . $this->variant);
     }
     echo Html::beginTag('div', $this->options);
     // header
     if ($this->header || !empty($this->boxTools)) {
         echo '<div class="box-header with-border">';
         echo Html::tag('h3', $this->header, ['class' => 'box-title']);
     }
     // box-tools
     if (!empty($this->boxTools)) {
         echo Html::beginTag('div', ['class' => 'box-tools pull-right']);
         foreach ($this->boxTools as $toolbox) {
             if (is_array($toolbox)) {
                 $tag = 'span';
                 if (($widget = ArrayHelper::getValue($toolbox, 'button')) !== null) {
                     $tag = 'button';
                     $toolbox['options']['data-widget'] = $widget;
                     Html::addCssClass($toolbox['options'], 'btn btn-box-tool');
                 } elseif (($label = ArrayHelper::getValue($toolbox, 'label')) !== null) {
                     Html::addCssClass($toolbox['options'], 'label label-' . $label);
                 } elseif (($badge = ArrayHelper::getValue($toolbox, 'badge')) !== null) {
                     Html::addCssClass($toolbox['options'], 'badge bg-' . $badge);
                 }
                 $tag = ArrayHelper::getValue($toolbox, 'tag', $tag);
                 $options = ArrayHelper::getValue($toolbox, 'options', []);
                 $text = ArrayHelper::getValue($toolbox, 'text', '');
                 $icon = ArrayHelper::getValue($toolbox, 'icon');
                 if ($icon !== null) {
                     $text .= ' ' . FA::icon($icon);
                 }
                 if (($tooltip = ArrayHelper::getValue($toolbox, 'tooltip')) !== null) {
                     $options['data-toggle'] = 'tooltip';
                     $options['title'] = $tooltip;
                 }
                 echo Html::tag($tag, $text, $options);
             } else {
                 echo $toolbox;
             }
         }
         echo '</div>';
     }
     if ($this->header || !empty($this->boxTools)) {
         echo '</div>';
     }
     // body
     echo '<div class="box-body">';
     echo $this->body;
 }
开发者ID:WiconWang,项目名称:CS-Iris,代码行数:62,代码来源:Box.php

示例5: init

 /**
  * Initializes the widget.
  * If you override this method, make sure you call the parent implementation first.
  */
 public function init()
 {
     parent::init();
     $this->clientOptions = false;
     if ($this->defaultClass) {
         Html::addCssClass($this->options, $this->defaultClass);
     }
 }
开发者ID:talview,项目名称:yii2-materialize,代码行数:12,代码来源:Button.php

示例6: icon

 /**
  * Fetch the icon for a icon identifier
  *
  * @param string $id suffix the icon suffix name
  * @param array  $options the icon HTML attributes
  * @param string $prefix the icon css prefix name
  *
  * @return string the parsed icon
  */
 public function icon($id, $options = ['style' => 'margin-right:5px'], $prefix = null)
 {
     if ($prefix === null) {
         $prefix = $this->prefix;
     }
     Html::addCssClass($options, explode(' ', $prefix . $id));
     return Html::tag('i', '', $options);
 }
开发者ID:communityii,项目名称:yii2-user,代码行数:17,代码来源:Icons.php

示例7: init

 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, ['weui_grid']);
     if (!isset($this->options['href'])) {
         $this->options['href'] = "javascript:;";
     }
 }
开发者ID:xjflyttp,项目名称:yii2-weui-widget,代码行数:8,代码来源:GridItem.php

示例8: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!in_array($this->layout, ['default', 'horizontal', 'inline'])) {
         throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
     }
     if ($this->layout !== 'default') {
         Html::addCssClass($this->options, 'form-' . $this->layout);
     }
     parent::init();
 }
开发者ID:codekissyoung,项目名称:filmfest,代码行数:13,代码来源:ActiveForm.php

示例9: inlineList

 /**
  * Renders and inline list
  * @param array $items the items to render
  * @param array $htmlOptions the HTML attributes
  * @return string the generated list
  */
 public static function inlineList($items, $htmlOptions = array())
 {
     $listItems = array();
     Html::addCssClass($htmlOptions, 'inline-list');
     foreach ($items as $item) {
         $listItems[] = \CHtml::tag('li', $htmlOptions, $item);
     }
     if (!empty($listItems)) {
         return \CHtml::tag('ul', $htmlOptions, implode("\n", $listItems));
     }
 }
开发者ID:2amigos,项目名称:yiifoundation,代码行数:17,代码来源:Typo.php

示例10: checkbox

 /**
  * @inheritdoc
  */
 public static function checkbox($name, $checked = false, $options = [])
 {
     $options['checked'] = (bool) $checked;
     $value = array_key_exists('value', $options) ? $options['value'] : '1';
     if (isset($options['uncheck'])) {
         // add a hidden field so that if the checkbox is not selected, it still submits a value
         $hidden = static::hiddenInput($name, $options['uncheck']);
         unset($options['uncheck']);
     } else {
         $hidden = '';
     }
     if (isset($options['label'])) {
         $label = $options['label'];
         $labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
         $divOptions = isset($options['divOptions']) ? $options['divOptions'] : [];
         Html::addCssClass($divOptions, 'checkbox');
         unset($options['label'], $options['labelOptions'], $options['divOptions']);
         $options['id'] = str_replace(['[]', '][', '[', ']', ' '], ['', '-', '-', '', '-'], $name) . '-' . $value;
         $content = Html::tag('div', static::input('checkbox', $name, $value, $options) . static::label($label, $options['id'], $labelOptions), $divOptions);
         return $hidden . $content;
     } else {
         return $hidden . static::input('checkbox', $name, $value, $options);
     }
 }
开发者ID:justinvoelker,项目名称:yii2-awesomebootstrapcheckbox,代码行数:27,代码来源:Html.php

示例11: 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:Jaaviieer,项目名称:PrograWeb,代码行数:11,代码来源:Alert.php

示例12: label

 /**
  * @inheritdoc
  */
 public function label($label = null, $options = [])
 {
     if (is_bool($label)) {
         $this->enableLabel = $label;
         if ($label === false && $this->form->layout === 'horizontal') {
             Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']);
         }
     } else {
         $this->enableLabel = true;
         $this->renderLabelParts($label, $options);
         parent::label($label, $options);
     }
     return $this;
 }
开发者ID:sx-dev,项目名称:court,代码行数:17,代码来源:ActiveField.php

示例13: 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:noorafree,项目名称:makmakan,代码行数:18,代码来源:Nav.php

示例14: renderAlert

 /**
  * Render single alert.
  * @param string $tag Alert html tag.
  * @param string $type Alert type.
  * @param string $alert Alert text.
  * @param array $options Alert type specific options.
  */
 protected function renderAlert($tag, $type, $alert, array $options)
 {
     $classes = ['alert', 'in', 'alert-' . $type];
     if ($options['block']) {
         $classes[] = 'alert-block';
     }
     if ($options['fade']) {
         $classes[] = 'fade';
     }
     Html::addCssClass($options['htmlOptions'], implode(' ', $classes));
     echo Html::openTag($tag, $options['htmlOptions']);
     if ($options['closeText'] !== false) {
         echo '<a href="#" class="close" data-dismiss="alert">' . $options['closeText'] . '</a>';
     }
     echo $alert;
     echo Html::closeTag($tag);
 }
开发者ID:intersvyaz,项目名称:yii-bootstrap,代码行数:24,代码来源:Alert.php

示例15: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $this->clientOptions = false;
     if (empty($this->options['class'])) {
         Html::addCssClass($this->options, ['navbar', 'navbar-default']);
     } else {
         Html::addCssClass($this->options, ['widget' => 'navbar']);
     }
     if (empty($this->options['role'])) {
         $this->options['role'] = 'navigation';
     }
     $options = $this->options;
     $tag = ArrayHelper::remove($options, 'tag', 'nav');
     echo Html::beginTag($tag, $options);
     if ($this->renderInnerContainer) {
         if (!isset($this->innerContainerOptions['class'])) {
             Html::addCssClass($this->innerContainerOptions, 'container');
         }
         echo Html::beginTag('div', $this->innerContainerOptions);
     }
     echo Html::beginTag('div', ['class' => 'navbar-header']);
     if (!isset($this->containerOptions['id'])) {
         $this->containerOptions['id'] = "{$this->options['id']}-collapse";
     }
     echo $this->renderToggleButton();
     if ($this->brandLabel !== false) {
         Html::addCssClass($this->brandOptions, ['widget' => 'navbar-brand']);
         echo Html::a($this->brandLabel, $this->brandUrl === false ? Yii::$app->homeUrl : $this->brandUrl, $this->brandOptions);
     }
     echo Html::endTag('div');
     Html::addCssClass($this->containerOptions, ['collapse' => 'collapse', 'widget' => 'navbar-collapse']);
     $options = $this->containerOptions;
     $tag = ArrayHelper::remove($options, 'tag', 'div');
     echo Html::beginTag($tag, $options);
 }
开发者ID:wozhen,项目名称:yii2-cms-writedown,代码行数:39,代码来源:NavBar.php


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