mymodule is in modules/custom directory.

$block['content']['#attached']['css'][] = drupal_get_path('module',
                                          'mymodule' . '/mymodule.css');

mymodule.css exists.

However file is not attached.


You have a typo in your statement. It should be:

$block['content']['#attached']['css'][] = drupal_get_path('module', 'mymodule') . '/mymodule.css';

Also, be sure to clear the cache after you add statements like this to your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.