Created
March 24, 2022 16:27
-
-
Save NikLP/ba2dd314f7d76a11c0f90ae6692660f1 to your computer and use it in GitHub Desktop.
Add inline styles to head tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function customtheme_preprocess_html(&$variables) { | |
$variables['#attached']['html_head'][] = [ | |
[ | |
'#type' => 'html_tag', | |
'#tag' => 'style', | |
'#value' => 'custom-class { background: red; }' | |
], | |
'my-custom-theme' | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment