I have this code.

     if ($_GET['q'] == 'entity/bundle'){ 
        unset($css[drupal_get_path('module', 'system') . '/system.base.css']);

Which I use in template.php to unset css on certain pages, but I want to have code (in this case unset css) to run on all entity pages for example entity/bundle/1, entity/bundle/2, entity/bundle/3. How can I get this to apply to all entity pages. I need something like entity/bundle/% or entity/bundle/* or maybe there is another way.

  • For one thing, you should probably be adding the CSS to the pages you need, not taking them off the ones you don't. Of course there are always edge cases I guess. As for doing what you asked, use a hook_preprocess_entity. This will allow you to act on all entities and use the machine name, title etc of the entities. – sareed May 16 '17 at 15:54

Context add assets seems to be a good solution for this https://www.drupal.org/project/context_addassets

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.