I would like to add custom property on drupal's stylesheets <link />
tag. I tried following in hook_css_alter
:
foreach ($css as &$style) {
$style['#attributes']['property'] = 'stylesheet';
$style['#attributes'] = ['property' => 'stylesheet'];
$style['property'] = 'stylesheet';
$style['element']['#theme'] = 'stylesheet';
$style['#markup'] = '<stylesheet />';
$style['element']['#markup'] = '<stylesheet />';
}
Nothing seeps to do any changes, and I feel like I am guessing around. So how to properly alter <link />
elements markup?
Second question would be how to get all stylesheets as array in theme. It seeps that in Drupal 8 beta 10 you cloud just do {% for style in styles %}
in Your twig template, but with beta 12 update this does not work, styles
returns placeholder element.
template_css_alter()
, you're probably thinking ofhook_css_alter()
which isn't meant to control the associated markup as far as I know.theme
file, and witch only in.modules
(only in modules)? I thought that functions starting withtemplate_
are meant to use in template andhook_
are meant to be used in modules, but now I know I was wrong