Commit b560c9bc by Alexander Makarov

Fixes #4457: Added support for using noscript for css files registered through…

Fixes #4457: Added support for using noscript for css files registered through asset bundles and Html helper
parent 5829020e
......@@ -11,6 +11,7 @@ Yii Framework 2 Change Log
- Enh #5223: Query builder now supports selecting sub-queries as columns (qiangxue)
- Enh #5587: `json_encode` is now used with `JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE` where it makes sense, also
it is now default for `Json::encode()` (samdark)
- Enh #4457: Added support for using noscript for css files registered through asset bundles and Html helper (samdark)
- Enh #5600: Allow configuring debug panels in `yii\debug\Module::panels` as panel class name strings (qiangxue)
- Enh #5613: Added `--overwrite` option to Gii console command to support overwriting all files (motin, qiangxue)
- Enh #5646: Call `yii\base\ErrorHandler::unregister()` instead of `restore_*_handlers` directly (aivus)
......
......@@ -197,8 +197,9 @@ class BaseHtml
* @param array $options the tag options in terms of name-value pairs. The following option is specially handled:
*
* - condition: specifies the conditional comments for IE, e.g., `lt IE 9`. When this is specified,
* the generated `script` tag will be enclosed within the conditional comments. This is mainly useful
* the generated `link` tag will be enclosed within the conditional comments. This is mainly useful
* for supporting old versions of IE browsers.
* - noscript: if set to true, `link` tag will be wrapped into `<noscript>` tags.
*
* The rest of the options will be rendered as the attributes of the resulting link tag. The values will
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
......@@ -217,6 +218,9 @@ class BaseHtml
$condition = $options['condition'];
unset($options['condition']);
return "<!--[if $condition]>\n" . static::tag('link', '', $options) . "\n<![endif]-->";
} elseif (isset($options['noscript']) && $options['noscript'] === true) {
unset($options['noscript']);
return "<noscript>" . static::tag('link', '', $options) . "</noscript>";
} else {
return static::tag('link', '', $options);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment