I've written a module which loads CSS and JS files using the #attached property. This works fine across most themes, but for some themes the files are not loading.
e.g.:
$page['header']['#attached']['css'][] = array(
'data' => drupal_get_path('module', 'mymodule') . '/css/mymodule_default.css',
'type' => 'file',
'options' => array(
'group' => CSS_THEME,
'preprocess' => TRUE,
'every_page' => TRUE,
),
);
As there is very little by way of explanation on #attached (most articles repeat the same stuff) I can't figure out where the problem may lie. Using drupal_add_css()
and drupal_add_js()
works, but is not recommended for caching reasons, and I prefer to pass settings using attached for this reason.
The #attached properties are showing in the $page
array but are not being rendered.
In summary, are there situations when certain themes block the correct rendering of #attached elements that would normally be applied to a render structure by drupal_process_attached()
Any help is appreciated.