本文整理汇总了PHP中yii\helpers\Html::cssStyleFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::cssStyleFromArray方法的具体用法?PHP Html::cssStyleFromArray怎么用?PHP Html::cssStyleFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::cssStyleFromArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: procPermaLink
protected function procPermaLink()
{
$id = $this->id . '-permalink';
$this->view->registerCss(sprintf('.label-permalink{%s}', Html::cssStyleFromArray(['cursor' => 'pointer', 'display' => 'inline-block', 'font-size' => '11px', 'font-weight' => '500', 'height' => '20px', 'padding' => '5px 8px 1px 6px', 'vertical-align' => 'top'])));
if ($this->looksClipboardWorks) {
ClipboardJsAsset::register($this->view);
$this->view->registerCss(sprintf('.label-permalink:hover{%s}', Html::cssStyleFromArray(['background-color' => '#1b3a63'])));
$this->view->registerJs(sprintf('jQuery("#%s").permaLink();', $id));
return Html::tag('span', sprintf('%s %s', FontAwesome::icon('anchor')->tag('span')->render(), Html::encode(Yii::t('app', 'Permalink'))), ['id' => $id, 'class' => ['label', 'label-success', 'label-permalink', 'auto-tooltip'], 'title' => Yii::t('app', 'Click to copy')]);
} else {
$this->view->registerCss(sprintf('.label-permalink{%s}', Html::cssStyleFromArray(['cursor' => 'not-allowed'])));
return Html::tag('span', sprintf('%s %s', FontAwesome::icon('anchor')->tag('span')->render(), Html::encode(Yii::t('app', 'PermaLink'))), ['id' => $id, 'class' => ['label', 'label-default', 'label-permalink', 'auto-tooltip'], 'title' => Yii::t('app', 'Your browser does not support this action.')]);
}
}
示例2: testCssStyleFromArray
public function testCssStyleFromArray()
{
$this->assertEquals('width: 100px; height: 200px;', Html::cssStyleFromArray(['width' => '100px', 'height' => '200px']));
$this->assertNull(Html::cssStyleFromArray([]));
}
示例3:
$maya = Yii::$app->cache->get(Yii::$app->session->getId() . '/maya');
if ($maya) {
$this->registerJs("LayoutMenu.init({$maya['maya']});");
} else {
$this->registerJs("LayoutMenu.init();");
}
if (Yii::$app->deviceDetect->isMobile()) {
$link = Url::to(['calendar/index']);
$options = [];
} else {
$link = 'javascript:void(0);';
$options = ['title' => 'Сегодня', 'id' => 'linkCalendar', 'data' => ['toggle' => 'popover', 'template' => '<div class="popover" role="tooltip" style="width: 500px;"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content" style="padding-bottom:30px;"></div></div>', 'html' => true, 'placement' => 'bottom']];
}
?>
<li><?php
echo Html::a(Html::tag('span', $maya !== false ? $maya['date'] : '# ### #### г.', ['style' => Html::cssStyleFromArray(['padding-right' => '10px']), 'id' => 'dateThis']) . Html::img($mayaAsset->getStampSrc($maya !== false ? $maya['stamp'] : \cs\models\Calendar\Maya::calc()['stamp']), ['height' => 20, 'width' => 20, 'id' => 'calendarMayaStamp']), $link, $options);
?>
</li>
</ul>
</div>
</div>
</nav>
<div class="hide" id="calendarMayaDescription">
<noindex>
<h4>Красный Дракон</h4>
<p>Откройтесь энергиям Рождения и Упования - Высшей Веры во всемогущесто бытия и стремитись найти им выражение в
своей жизни. Фокусируйтесь на самоподдержании и принятии необходимой энергии от Вселенной, и тогда ваши
глубинные потребности начнут восполняться самой жизнью. Позвольте энергии рождения инициировать и проявлять все
ваши начинания!</p>
示例4:
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-contact">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<hr>
<?php
echo Html::tag('hoogl', '111', ['class' => 'hoogl', 'data' => '1212']);
?>
<?php
echo Html::cssFile('/asssets/q.css');
?>
<?php
print_r(Html::cssStyleFromArray(['width' => '100px', 'height' => '200px']));
?>
<hr>
<?php
if (Yii::$app->session->hasFlash('contactFormSubmitted')) {
?>
<div class="alert alert-success">
Thank you for contacting us. We will respond to you as soon as possible.
</div>
<p>
Note that if you turn on the Yii debugger, you should be able
to view the mail message on the mail panel of the debugger.
<?php
示例5: getLangFieldFlagStyle
/**
* Return current flag for dynamic fields
* @param $flagPic
* @return string
*/
private function getLangFieldFlagStyle($flagPic)
{
$flagClass = ['background-image' => "url(" . $flagPic . ")", 'background-repeat' => 'no-repeat', 'background-position' => '99% 10px', 'background-size' => '16px 11px'];
return "<style> .mlang{" . Html::cssStyleFromArray($flagClass) . "}</style>";
}