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


PHP Html::style方法代码示例

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


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

示例1: run

 public function run()
 {
     $modelId = $this->model->isNewRecord ? uniqid() : $this->model->getId();
     $this->options = array_merge($this->_options, $this->options);
     $this->options['toolbarFixed'] = true;
     $this->options['toolbarFixedTarget'] = '#' . $this->htmlOptions['id'];
     $this->htmlOptions = array_merge($this->_htmlOptions, $this->htmlOptions);
     $buttonParam = isset($this->options['airButtons']) && $this->options['airButtons'] == true ? 'airButtons' : 'buttons';
     $this->plugins = ['fullscreen', 'fontcolor', 'fontsize'];
     switch ($this->toolbarSize) {
         case 'full':
             $this->options[$buttonParam] = ['html', 'formatting', '|', 'bold', 'italic', 'underline', 'deleted', 'fontsize', 'fontcolor', 'backcolor', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'video', 'file', 'table', 'link', 'alignment', 'horizontalrule'];
             break;
         case 'medium':
             $this->options[$buttonParam] = ['bold', 'italic', 'underline', 'deleted', 'fontsize', 'fontcolor', 'backcolor', '|', 'unorderedlist', 'orderedlist', '|', 'image', 'video', 'file', 'table', 'link'];
             break;
         default:
             $this->options[$buttonParam] = ['bold', 'italic', 'underline', 'deleted', 'link'];
             break;
     }
     switch ($this->size) {
         case 'full':
             $this->htmlOptions['style'] = "height: 100%";
             break;
         case 'large':
             $this->htmlOptions['rows'] = 12;
             break;
         case 'medium':
             $this->htmlOptions['rows'] = 6;
             break;
         default:
             $this->htmlOptions['rows'] = 3;
             break;
     }
     if ($this->enableFiles) {
         array_push($this->plugins, 'imagemanager', 'filemanager');
         $this->options['imageUpload'] = ArrayHelper::getValue($this->options, 'imageUpload', '/image/save/' . $this->model->isWHat() . '/' . $modelId);
         $this->options['imageManagerJson'] = json_encode(array_map(function ($image) {
             if (is_array($image)) {
                 return ['thumb' => $image['metadata']['thumb'], 'image' => $image['url'], 'title' => $image['title']];
             }
         }, (array) \nitm\filemanager\models\Image::getImagesFor($this->model, true)->asArray()->all()));
         $this->options['fileUpload'] = ArrayHelper::getValue($this->options, 'fileUpload', '/file/save/' . $this->model->isWHat() . '/' . $modelId);
         $this->options['fileManagerJson'] = json_encode(array_map(function ($file) {
             if (is_array($file)) {
                 return ['name' => $file['metadata']['thumb'], 'image' => $file['url'], 'name' => $file['file_name'], 'title' => $file['title'], 'size' => \Yii::$app->formatter->asShortSize($file['size'])];
             }
         }, (array) \nitm\filemanager\models\File::getFilesFor($this->model, true)->asArray()->all()));
     }
     $this->htmlOptions['role'] = $this->role;
     return parent::run() . \yii\helpers\Html::style("#redactor_modal_overlay, #redactor_modal, .redactor_dropdown {z-index: 10000 !important;}");
 }
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:52,代码来源:Editor.php

示例2: initTheme

 /**
  *
  * @param \yii\web\Application $app            
  * @see \yii\base\BootstrapInterface::bootstrap()
  */
 public function initTheme()
 {
     if (($themeId = \Yii::$app->getRequest()->get("theme", null)) != null) {
         \Yii::$app->getUrlManager()->on(UrlManager::EVENT_CREATE_PARAMS, function ($event) use($themeId) {
             $event->urlParams = array_merge(["theme" => $themeId], (array) $event->urlParams);
         });
     } else {
         $themeId = \Yii::$app->get("themeManager")->getDefaultThemeId();
     }
     /** @var \hass\theme\classes\ThemeInfo $themeInfo */
     $themeInfo = \Yii::$app->get("themeManager")->findOne($themeId);
     $package = $themeInfo->getPackage();
     $config = [];
     if (!empty($css = \Yii::$app->get("themeManager")->getCustomCss($package))) {
         $config["css"] = [md5($css) => Html::style($css)];
     }
     $config["theme"] = ['package' => $package, 'class' => '\\hass\\frontend\\components\\Theme', 'assetClass' => $themeInfo->getAssetClass(), 'pathMap' => $themeInfo->getPathMap()];
     Util::setComponent("view", $config, true);
     $theme = $themeInfo->createEntity();
     if ($theme instanceof BootstrapInterface) {
         $theme->bootstrap(\Yii::$app);
     }
 }
开发者ID:rocketyang,项目名称:hasscms-app,代码行数:28,代码来源:Module.php

示例3: testStyle

 public function testStyle()
 {
     $content = 'a <>';
     $this->assertEquals("<style>{$content}</style>", Html::style($content));
     $this->assertEquals("<style type=\"text/less\">{$content}</style>", Html::style($content, ['type' => 'text/less']));
 }
开发者ID:rajanishtimes,项目名称:basicyii,代码行数:6,代码来源:HtmlTest.php

示例4: registerCss

 /**
  * Registers a CSS code block.
  * @param string $css the content of the CSS code block to be registered
  * @param array $options the HTML attributes for the `<style>`-tag.
  * @param string $key the key that identifies the CSS code block. If null, it will use
  * $css as the key. If two CSS code blocks are registered with the same key, the latter
  * will overwrite the former.
  */
 public function registerCss($css, $options = [], $key = null)
 {
     $key = $key ?: md5($css);
     $this->css[$key] = Html::style($css, $options);
 }
开发者ID:Abbas-Hashemian,项目名称:yii2,代码行数:13,代码来源:View.php

示例5: generateMessages

 /**
  * Generate default messages
  */
 public function generateMessages()
 {
     if (!isset($this->footerMessage)) {
         $this->footerMessage = $this->getFooterMessage();
     }
     if (!isset($this->emptyPreview)) {
         $this->emptyPreview = '<p class="help-block text-center">' . Yii::t('markdown', 'No content to display') . '</p>';
     }
     $exportAlert = 'Your {type} file will be generated and downloaded as {filename}.';
     $popupAlert = Yii::t('markdown', 'Disable any popup blockers in your browser to ensure proper download.');
     if (empty($this->exportFileName)) {
         $this->exportFileName = Yii::t('markdown', 'markdown-export');
     }
     if (!isset($this->exportTextAlert)) {
         $this->exportTextAlert = Yii::t('markdown', $exportAlert, ['type' => Yii::t('markdown', 'TEXT'), 'filename' => $this->exportFileName . '.txt']) . "\n\n" . $popupAlert;
     }
     if (!isset($this->exportHtmlAlert)) {
         $this->exportHtmlAlert = Yii::t('markdown', $exportAlert, ['type' => Yii::t('markdown', 'HTML'), 'filename' => $this->exportFileName . '.htm']) . "\n\n" . $popupAlert;
     }
     if (!isset($this->exportHeader)) {
         $this->exportHeader = "> - - -\n> " . Yii::t('markdown', "Markdown Export{line} *Generated {date} by {class}", ['line' => "\n> ===============\n>", 'date' => date("d-M-Y H:i"), 'class' => "\\kartik\\markdown\\MarkdownEditor*\n> - - -\n\n"]);
     }
     if (!isset($this->exportCss)) {
         $this->exportCss = Html::cssFile($this->bootstrapCssFile) . "\n" . Html::style('body{margin:20px;padding:20px;border:1px solid #ddd;border-radius:5px;}' . 'th[align="right"]{text-align:right!important;}' . 'th[align="center"]{text-align:center!important;}');
     }
     if (!isset($this->previewProgress)) {
         $this->previewProgress = '<div class="kv-loading">' . Yii::t('markdown', 'Loading Preview') . ' &hellip;</div>';
     }
 }
开发者ID:kangqf,项目名称:yii2-markdown,代码行数:32,代码来源:MarkdownEditor.php

示例6:

    Html::removeCssClass($options, 'btn-default');
    Html::addCssClass($options, 'btn-success');
}
echo Html::tag('div', 'sdsdsd dddd', $options);
$id = 2;
$option = [['id' => 1, 'name' => 'one'], ['id' => 2, 'name' => 'two'], ['id' => 3, 'name' => 'three'], ['id' => 4, 'name' => 'four']];
$post = ['title' => 'this is title', 'name' => 'this is name', 'child' => [1000, 200]];
echo Html::getInputName($model, 'username');
echo Html::getAttributeValue($model, 'username');
echo Html::tag('hr');
echo Html::getInputId($model, 'username');
echo Html::tag('hr');
?>

<?php 
echo Html::style('.username{color:red;font-size:8px;}');
echo Html::script('alert("script is test")', ['defer' => true]);
echo Html::tag('br/');
echo Html::cssFile('@web/css/ie5.css', ['condition' => 'IE 5']);
echo Html::jsFile('@web/js/main.js');
echo Html::a('超链接', ['home/list', 'id' => 12], ['class' => 'link']);
echo Html::mailto('Contact Us', 'xingcuntian@163.com');
echo Html::img('@web/images/logo.png', ['alt' => 'logo']);
?>
<hr/>

<?php 
echo Html::beginForm(['home/add', 'id' => $id], 'post', ['enctype' => 'multipart/form-data']);
echo Html::input('text', 'username', 'name', ['class' => 'name']);
echo Html::radio('agree', true, ['label' => 'this is radio']);
echo Html::checkbox('agree', true, ['label' => 'this is checkbox']);
开发者ID:xingcuntian,项目名称:component_test,代码行数:31,代码来源:index.php


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