Skip to content

Commit 6ed004c

Browse files
committed
custom style option implementation
1 parent 8f2be61 commit 6ed004c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

framework/helpers/BaseHtml.php

+5
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ public static function endTag($name)
205205
*/
206206
public static function style($content, $options = [])
207207
{
208+
$view = Yii::$app->getView();
209+
if ($view instanceof \yii\web\View && !empty($view->styleOptions)) {
210+
$options = array_merge($view->styleOptions, $options);
211+
}
212+
208213
return static::tag('style', $content, $options);
209214
}
210215

framework/web/View.php

+7
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ class View extends \yii\base\View
120120
* @see registerCssFile()
121121
*/
122122
public $cssFiles = [];
123+
124+
/**
125+
* @since 2.0.52
126+
* @var array the style tag options.
127+
*/
128+
public $styleOptions = [];
129+
123130
/**
124131
* @var array the registered JS code blocks
125132
* @see registerJs()

0 commit comments

Comments
 (0)