本文整理汇总了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;
}
示例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;
}
示例3: getNameColor
public function getNameColor()
{
return Html::badge($this->name, ['class' => 'btn btn-xs btn-block ' . $this->color]);
}
示例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) {