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


PHP Html::badge方法代码示例

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


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

示例1: getOrderStatusArray

 /**
  * @return array [[DropDownList]]
  */
 public static function getOrderStatusArray($asHtml = false)
 {
     $cacheKey = 'OrderStatusItems:' . implode(':', [intval($asHtml)]);
     $items = Yii::$app->cache->get($cacheKey);
     if ($items !== false) {
         return $items;
     }
     $data = self::find()->select(['order_status_id', 'name', 'color'])->orderBy('name ASC')->asArray()->all();
     $cache_tags = [ActiveRecordHelper::getCommonTag(static::className())];
     foreach ($data as $val) {
         $key = $val['order_status_id'];
         $items[$key] = $asHtml ? Html::badge($val['name'], ['class' => 'btn btn-xs btn-block ' . $val['color']]) : $val['name'];
         $cache_tags[] = ActiveRecordHelper::getObjectTag(static::className(), $key);
     }
     Yii::$app->cache->set($cacheKey, $items, 86400, new TagDependency(['tags' => $cache_tags]));
     return $items;
 }
开发者ID:sap55,项目名称:yii2-order-management,代码行数:20,代码来源:OrderStatus.php

示例2: getIcon

 /**
  * 
  * @param type $name
  * @param array $config
  */
 public static function getIcon($input, array $config = [])
 {
     //Lookup DB Value corresponding to input
     $model = models\IconRegister::findOne(['name' => $input]);
     $icon = NULL;
     if (!isset($model) || $model->framework_id == 'bdg') {
         $icon = isset($model) ? $model->icon : $input;
         $config['as_badge'] = TRUE;
     } else {
         $icon = Html::icon($model->icon, $config, $model->framework_id == 'bsg' ? 'glyphicon glyphicon-' : 'fa fa-fw fa-');
     }
     $output = $icon;
     if (isset($config['as_badge']) && $config['as_badge'] == TRUE) {
         $output = Html::badge($output . ' ' . (isset($config['label']) && isset($config['label_as_badge']) ? $config['label'] : ''), $config);
     }
     $label = isset($config['label']) && !isset($config['label_as_badge']) ? ' ' . $config['label'] : '';
     return $output . $label;
 }
开发者ID:humanized,项目名称:yii2-iconhelper,代码行数:23,代码来源:IconHelper.php

示例3: getNameColor

 public function getNameColor()
 {
     return Html::badge($this->name, ['class' => 'btn btn-xs btn-block ' . $this->color]);
 }
开发者ID:sap55,项目名称:yii2-order-management,代码行数:4,代码来源:PaymentStatus.php

示例4: foreach

                 <h3 class="panel-title">APIs to see</h3>
             </div>
             <ul class="recommendation-list list-group">
                 <?php 
 foreach ($recommend['hits']['hits'] as $rec) {
     echo '<li class="list-group-item">';
     echo Html::a($rec['fields']['name'][0], ['view', 'id' => $rec['_id']]);
     if (array_key_exists('inner_hits', $rec)) {
         $show_objects_to_fork = false;
         foreach ($rec['inner_hits'] as $innner_hitsRec) {
             if ($innner_hitsRec['hits']['total'] > 0) {
                 $show_objects_to_fork = true;
             }
         }
         if ($show_objects_to_fork) {
             echo Html::a(Html::badge(Html::icon('chevron-right', ['class' => 'badge-success'])), null, ['class' => 'pull-right', 'id' => str_replace(' ', '', $rec['fields']['name'][0])]);
         }
     }
     echo '</li>';
 }
 ?>
             </ul>
         </div>
     </div>
     <?php 
 foreach ($recommend['hits']['hits'] as $key => $rec) {
     $recDivID = 'recommendation-object-block-' . str_replace(' ', '', $rec['fields']['name'][0]);
     if (array_key_exists('inner_hits', $rec)) {
         $objectsToShowNoDupsNames = [];
         $objectsToShowNoDupsIds = [];
         foreach ($rec['inner_hits'] as $innner_hitsRec) {
开发者ID:openi-ict,项目名称:api-builder,代码行数:31,代码来源:view.php


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