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


PHP TbHtml::defaultOption方法代码示例

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


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

示例1: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     /* @var $user CWebUser */
     $user = Yii::app()->getUser();
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->alerts as $style => $alert) {
         if (isset($alert['visible']) && !$alert['visible']) {
             continue;
         }
         if ($user->hasFlash($style)) {
             $htmlOptions = TbHtml::popOption('htmlOptions', $alert, array());
             $htmlOptions = TbHtml::defaultOption('closeText', $this->closeText, $htmlOptions);
             $htmlOptions = TbHtml::defaultOption('block', $this->block, $htmlOptions);
             $htmlOptions = TbHtml::defaultOption('fade', $this->fade, $htmlOptions);
             echo TbHtml::alert($style, $user->getFlash($style), $htmlOptions);
         }
     }
     echo '</div>';
     $this->registerEvents("#{$this->htmlOptions['id']} > .alert", $this->events);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:23,代码来源:TbAlert.php

示例2: init

 /**
  * Widget's initialization method
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     $this->htmlOptions = TbHtml::defaultOption('placement', $this->placement, $this->htmlOptions);
     $this->initEvents();
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:10,代码来源:TbTabs.php

示例3: renderButton

 /**
  * Renders a link button.
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $url = TbHtml::popOption('url', $button, '#');
     if (strcmp($url, '#') !== 0) {
         $url = $this->evaluateExpression($url, array('data' => $data, 'row' => $row));
     }
     $imageUrl = TbHtml::popOption('imageUrl', $button, false);
     $label = TbHtml::popOption('label', $button, $id);
     $options = TbHtml::popOption('options', $button, array());
     $options = TbHtml::defaultOption('title', $label, $options);
     $options = TbHtml::defaultOption('rel', 'tooltip', $options);
     if ($icon = TbHtml::popOption('icon', $button, false)) {
         /* todo: not sure if we require this anymore */
         if (strpos($icon, 'icon') === false) {
             $icon = 'icon-' . implode(' icon-', explode(' ', $icon));
         }
         echo CHtml::link('<i class="' . $icon . '"></i>', $url, $options);
     } else {
         if ($imageUrl && is_string($imageUrl)) {
             echo CHtml::link(CHtml::image($imageUrl, $label), $url, $options);
         } else {
             echo CHtml::link($label, $url, $options);
         }
     }
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:35,代码来源:TbButtonColumn.php

示例4: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->htmlOptions = TbHtml::defaultOption('id', $this->getId(), $this->htmlOptions);
     if (isset($this->size)) {
         $this->htmlOptions = TbHtml::defaultOption('size', $this->size, $this->htmlOptions);
     }
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:10,代码来源:TbPager.php

示例5: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     if (isset($this->size)) {
         $this->htmlOptions = TbHtml::defaultOption('size', $this->size, $this->htmlOptions);
     }
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:11,代码来源:TbPager.php

示例6: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->htmlOptions['data-spy'] = 'affix';
     if (isset($this->offset)) {
         if (is_string($this->offset)) {
             $this->offset = array('top', $this->offset);
         }
         if (is_array($this->offset) && count($this->offset) === 2) {
             list($position, $offset) = $this->offset;
             if (in_array($position, TbHtml::$navbarPositions)) {
                 $this->options = TbHtml::defaultOption('data-offset-' . $position, $offset, $this->options);
             }
         }
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:19,代码来源:TbAffix.php

示例7: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->htmlOptions = TbHtml::defaultOption('id', $this->getId(), $this->htmlOptions);
     $this->htmlOptions = TbHtml::addClassName('collapse', $this->htmlOptions);
     $this->htmlOptions['data-toggle'] = 'collapse';
     if (isset($this->parent)) {
         $this->htmlOptions = TbHtml::defaultOption('data-parent', $this->parent, $this->htmlOptions);
     }
     if (isset($this->toggle) && $this->toggle) {
         $this->htmlOptions = TbHtml::addClassName('in', $this->htmlOptions);
     }
     $controller = $this->getController();
     if (isset($controller) && $controller->getViewFile($this->content) !== false) {
         $this->content = $this->controller->renderPartial($this->content, $this->viewData, true);
     }
     echo CHtml::tag($this->tagName, $this->htmlOptions, $this->content);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:20,代码来源:TbCollapse.php

示例8: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     if ($this->brandLabel !== false) {
         if (!isset($this->brandLabel)) {
             $this->brandLabel = CHtml::encode(Yii::app()->name);
         }
         if (!isset($this->brandUrl)) {
             $this->brandUrl = Yii::app()->homeUrl;
         }
     }
     if (isset($this->color)) {
         $this->htmlOptions = TbHtml::defaultOption('color', $this->color, $this->htmlOptions);
     }
     if (isset($this->display) && $this->display !== TbHtml::NAVBAR_DISPLAY_NONE) {
         $this->htmlOptions = TbHtml::defaultOption('display', $this->display, $this->htmlOptions);
     }
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:20,代码来源:TbNavbar.php

示例9: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     $this->htmlOptions['data-spy'] = 'affix';
     if (isset($this->offset)) {
         if (is_string($this->offset)) {
             $this->offset = array('top', $this->offset);
         }
         if (is_array($this->offset) && count($this->offset) === 2) {
             list($position, $offset) = $this->offset;
             if (!empty($position)) {
                 $this->options = TbHtml::defaultOption('data-offset-' . $position, $offset, $this->options);
             }
         }
     }
     echo TbHtml::openTag($this->tagName, $this->htmlOptions);
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:21,代码来源:TbAffix.php

示例10: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     $this->htmlOptions = TbHtml::addClassName('collapse', $this->htmlOptions);
     if (isset($this->parent)) {
         $this->htmlOptions = TbHtml::defaultOption('data-parent', $this->parent, $this->htmlOptions);
     }
     if (isset($this->toggle) && $this->toggle) {
         $this->htmlOptions = TbHtml::addClassName('in', $this->htmlOptions);
     }
     if (isset($this->view)) {
         $controller = $this->getController();
         if (isset($controller) && $controller->getViewFile($this->view) !== false) {
             $this->content = $this->controller->renderPartial($this->view, $this->viewData, true);
         }
     }
     echo TbHtml::openTag($this->tagName, $this->htmlOptions);
     echo $this->content;
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:23,代码来源:TbCollapse.php

示例11: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     if ($this->brandLabel !== false) {
         if (!isset($this->brandLabel)) {
             $this->brandLabel = CHtml::encode(Yii::app()->name);
         }
         if (!isset($this->brandUrl)) {
             $this->brandUrl = Yii::app()->homeUrl;
         }
     }
     // todo: somehow the style attribute in htmlOptions is ignored completely, fix.
     if (isset($this->style)) {
         $this->htmlOptions = TbHtml::defaultOption('style', $this->style, $this->htmlOptions);
     }
     if ($this->position !== false) {
         $this->htmlOptions = TbHtml::defaultOption('position', $this->position, $this->htmlOptions);
     }
     if ($this->static) {
         $this->htmlOptions = TbHtml::defaultOption('static', $this->static, $this->htmlOptions);
     }
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:24,代码来源:TbNavbar.php

示例12: normalizeItems

 /**
  * Normalizes the menu items.
  * @param array $items the items to be normalized.
  * @param string $route the route of the current request.
  * @param boolean $active whether there is an active child menu item.
  * @return array the normalized menu items.
  */
 protected function normalizeItems($items, $route, &$active)
 {
     foreach ($items as $i => $item) {
         // skip dividers
         if (is_string($item)) {
             continue;
         }
         if (isset($item['visible']) && !$item['visible']) {
             unset($items[$i]);
             continue;
         }
         $item = TbHtml::defaultOption('label', '', $item);
         if ($this->encodeLabel) {
             $items[$i]['label'] = CHtml::encode($item['label']);
         }
         if (!isset($item['url']) && !isset($item['items'])) {
             $items[$i]['header'] = true;
         }
         $hasActiveChild = false;
         if (isset($item['items']) && !empty($item['items'])) {
             $items[$i]['items'] = $this->normalizeItems($item['items'], $route, $hasActiveChild);
             if (empty($items[$i]['items']) && $this->hideEmptyItems) {
                 unset($items[$i]['items']);
                 if (!isset($item['url'])) {
                     unset($items[$i]);
                     continue;
                 }
             }
         }
         if (!isset($item['active'])) {
             if ($this->activateParents && $hasActiveChild || $this->activateItems && $this->isItemActive($item, $route)) {
                 $active = $items[$i]['active'] = true;
             } else {
                 $items[$i]['active'] = false;
             }
         } else {
             if ($item['active']) {
                 $active = true;
             }
         }
     }
     return array_values($items);
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:50,代码来源:TbNav.php

示例13: renderButton

 /**
  * Renders the button
  */
 public function renderButton()
 {
     if (!empty($this->buttonOptions) && is_array($this->buttonOptions)) {
         $this->buttonOptions = TbHtml::defaultOption('data-toggle', 'modal', $this->buttonOptions);
         if ($this->remote !== null) {
             $this->buttonOptions = TbHtml::defaultOption('data-remote', CHtml::normalizeUrl($this->remote), $this->buttonOptions);
         }
         $selector = '#' . $this->htmlOptions['id'];
         $label = TbHtml::popOption('label', $this->buttonOptions, 'button');
         $attr = isset($this->buttonOptions['data-remote']) ? 'data-target' : 'href';
         $this->buttonOptions = TbHtml::defaultOption($attr, $selector, $this->buttonOptions);
         echo TbHtml::button($label, $this->buttonOptions);
     }
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:17,代码来源:TbModal.php

示例14: normalizeTabs

 /**
  * Normalizes the tab configuration.
  * @param array $tabs the tab configuration
  * @param array $panes a reference to the panes array
  * @param integer $i the current index
  * @return array the items
  */
 protected function normalizeTabs($tabs, &$panes, &$i = 0)
 {
     $id = TbHtml::getOption('id', $this->htmlOptions, $this->getId());
     $items = array();
     //Check if has an active item
     $hasActiveItem = false;
     foreach ($tabs as $tab) {
         if ($hasActiveItem = TbHtml::getOption('active', $tab, false) === true) {
             break;
         }
     }
     foreach ($tabs as $tab) {
         $item = $tab;
         if (isset($item['visible']) && $item['visible'] === false) {
             continue;
         }
         // if no tab should be active, activate first
         if (!$hasActiveItem && $i == 0) {
             $item['active'] = true;
         }
         // set the label to the title if any
         if (isset($item['title'])) {
             $item['label'] = TbHtml::defaultOption('label', TbHtml::popOption('title', $item), $item);
         }
         $item = TbHtml::defaultOption('itemOptions', array(), $item);
         if (isset($tab['items'])) {
             $item['linkOptions']['data-toggle'] = 'dropdown';
             $item['items'] = $this->normalizeTabs($item['items'], $panes, $i);
         } else {
             $item['linkOptions']['data-toggle'] = 'tab';
             $item = TbHtml::defaultOption('id', $id . '_tab_' . ($i + 1), $item);
             $item['url'] = '#' . $item['id'];
             // no content and we have a view?
             if (!isset($item['content']) && isset($item['view'])) {
                 $view = TbHtml::popOption('view', $item, '');
                 $data = TbHtml::popOption('data', $item, array());
                 if (is_array($this->viewData)) {
                     $data = TbHtml::mergeOptions($this->viewData, $data);
                 }
                 $process = TbHtml::popOption('processOutput', $item, false);
                 $item['content'] = !empty($view) ? $this->getController()->renderPartial($view, $data, true, $process) : '';
             }
             $content = TbHtml::popOption('content', $item, '');
             $paneOptions = TbHtml::popOption('paneOptions', $item, array());
             $paneOptions['id'] = TbHtml::popOption('id', $item);
             $classes = array('tab-pane fade');
             if (isset($item['active']) && $item['active']) {
                 $classes[] = 'active in';
             }
             $paneOptions = TbHtml::addClassName(implode(' ', $classes), $paneOptions);
             $panes[] = CHtml::tag('div', $paneOptions, $content);
             $i++;
             // increment the tab-index
         }
         $items[] = $item;
     }
     return $items;
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:65,代码来源:TbTabs.php

示例15: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->htmlOptions = TbHtml::defaultOption('divider', $this->divider, $this->htmlOptions);
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:7,代码来源:TbBreadcrumb.php


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