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.

1 Answer 1


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 and acknowledge you have read our privacy policy.

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