Exclude content highlighting on console request (#7000)

This commit is contained in:
Yuriy Bakhtin 2024-05-13 11:13:27 +02:00 committed by GitHub
parent 3e1245ebed
commit d216e221ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,10 +29,12 @@ class ContentHighlightAsset extends AssetBundle
*/
public static function register($view)
{
$highlight = Yii::$app->session->get('contentHighlight');
if ($highlight !== null && $highlight !== '') {
Yii::$app->session->remove('contentHighlight');
$view->registerJsConfig('content.highlight', ['keyword' => $highlight]);
if (!Yii::$app->request->isConsoleRequest) {
$highlight = Yii::$app->session->get('contentHighlight');
if ($highlight !== null && $highlight !== '') {
Yii::$app->session->remove('contentHighlight');
$view->registerJsConfig('content.highlight', ['keyword' => $highlight]);
}
}
return parent::register($view);