本文整理汇总了PHP中Html::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::tag方法的具体用法?PHP Html::tag怎么用?PHP Html::tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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;
}
}
}
}
示例3: run
public function run()
{
if (!isset($this->parentType)) {
throw new InvalidConfigException("Tag parent type is required.");
}
$tagsHtml = $this->renderWidget();
return Html::tag('div', $tagsHtml, $this->options);
}
示例4: message
function message($mesasge, $error = false)
{
if ($error) {
echo Html::tag('div', $mesasge, array('class' => 'alert alert-danger'));
} else {
echo Html::tag('div', $mesasge, array('class' => 'alert alert-success'));
}
}
示例5: getToolTipTemplate
/**
* Generate the tool tip template to use in form.
*
* @param string $field The table field name.
* @return string Return the tool tip template.
*/
public function getToolTipTemplate($field)
{
if (array_key_exists($field, $this->toolTips())) {
$toolTip = Html::tag('span', "{label}", ['data-content' => $this->toolTips()[$field], 'data-toggle' => 'popover', 'data-trigger' => 'hover', 'style' => 'cursor:help; border-bottom: 1px dashed #888']);
return "{$toolTip} \n{input}\n{hint}\n{error}";
}
return "{label}\n{input}\n{hint}\n{error}";
}
示例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);
}
示例7: run
/**
* Renders the widget.
*/
public function run()
{
$this->registerPlugin('button');
$this->label = $this->getLabel();
if ($this->enableIcon) {
$this->label .= Icon::widget(['label' => $this->icon, 'options' => $this->iconOptions]);
}
return Html::tag($this->tagName, $this->label, $this->options);
}
示例8: run
public function run()
{
if (empty($this->items)) {
return '';
}
$options = $this->options;
$content = $this->renderItems();
return Html::tag('div', $content, $options);
}
示例9: testPrintsWithTheMethodWithWrapper
/**
* test method
*/
public function testPrintsWithTheMethodWithWrapper()
{
$helper = ConcreteHelper::getInstance();
ob_start();
$helper->the('hey', Html::tag('span'));
$content = ob_get_contents();
ob_end_clean();
$this->assertEquals('<span>hey</span>', $content);
}
示例10: renderMenuItem
protected function renderMenuItem($item)
{
if (isset($item['url'])) {
$icon = isset($item['icon']) ? '<i class="fa ' . $item['icon'] . '"></i>' : '';
$count = isset($item['count']) ? '<span class="' . (isset($item['countClass']) ? $item['countClass'] : 'dataNumGreen') . '">' . $item['count'] . '</span>' : '';
$label = $this->linkLabelWrapper === null ? $item['label'] : Html::tag($this->linkLabelWrapper, $this->linkLabelWrapperHtmlOptions, $item['label']);
return Html::link($icon . $label . $count, $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
} else {
return Html::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
}
}
示例11: run
public function run()
{
$container = 'div';
if (isset($this->containerOptions['tag'])) {
$container = $this->containerOptions['tag'];
unset($this->containerOptions['tag']);
}
echo Html::tag($container, Html::tag('iframe', '', $this->frameOptions), $this->containerOptions);
if (!empty($this->callbackFunction)) {
AssetsCallBack::register($this->getView());
$this->getView()->registerJs("mihaildev.elFinder.register(" . Json::encode($this->id) . "," . Json::encode($this->callbackFunction) . ");");
}
}
示例12: datagrid
public function datagrid($mcs, $limit = 10)
{
// $this->debug=true;
$datas = array_map(function ($x) {
return $x->toArray();
}, $this->model($mcs, null, $limit));
// mdd($datas);
$arrTables = array();
foreach ($datas as $data) {
$arrTables[] = app()->make('\\Mkny\\Cinimod\\Logic\\TableLogic')->setRows($data)->getTable();
}
return \Html::tag('div', $arrTables);
}
示例13: init
public function init()
{
echo '<div class="box box-primary">' . ' <div class="box-header with-border">';
echo Html::tag('h3', $this->options['boxTitle'], ['class' => 'box-title']);
echo '<div class="box-tools pull-right">';
echo Html::button('<i class="fa fa-save"></i>', ['type' => 'submit', 'class' => 'btn btn-sm btn-primary', 'title' => \Yii::t('theme/widgets/box', 'Save')]);
echo ' ';
if (isset($this->options['buttonUndo'])) {
echo Html::a('<i class="fa fa-undo"></i>', $this->options['buttonUndo'], ['class' => 'btn btn-sm btn-default', 'title' => \Yii::t('theme/widgets/box', 'Undo')]);
}
echo '</div>';
echo '</div>';
echo '<div class="box-body form-horizontal">';
}
示例14: redirect
public function redirect($url, $force = false, $statusCode = 302)
{
$params = Yii::$app->request->queryParams;
// Meta redirect
if (headers_sent() || ob_get_contents()) {
$url = !empty($params['_return_url']) ? $params['_return_url'] : $url;
$url = Url::to($url);
$this->ech(Html::tag('meta', '', ['http-equiv' => 'Refresh', 'content' => '1;URL=' . $url . '']));
$this->ech(Html::a(__('Continue'), $url));
}
if (!empty($params['_return_url']) && !$force) {
return Yii::$app->getResponse()->redirect($params['_return_url'], $statusCode);
}
return parent::redirect($url, $statusCode);
}
示例15: renderForEdit
/**
* Returns the fields for edit screen
*
* @return string
*/
public function renderForEdit()
{
global $tag;
$data = array();
foreach ($this->dataHandler->getFillable() as $field) {
$data[$field->getBaseName()] = apply_filters('wd-fieldcreator-get-field-' . $this->prefix . $field->getBaseName(), wd_get_term_meta($tag->term_id, $this->prefix . $field->getBaseName()));
}
$this->dataHandler->populate($data)->execute();
foreach ($this->dataHandler->getContent() as $content) {
if (is_a($content, 'FG_HTML_Form_Input_Fillable')) {
$html[] = Html::tag('tr', array(Html::tag('th', $content->getLabel()), Html::tag('td', $content->getField())))->setClass('form-field wd-taxonomy-fieldcreator');
} else {
$html[] = $content;
}
}
return join('', $html);
}