Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Theme alter hooks for CSS and JavaScript

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:03
    Theme Alter Hooks for CSS and JavaScript
  • 0:06
    with Joe Shindelar
  • 0:08
    In this chapter, we're
  • 0:09
    going to talk about implementing hooks inside of a theme.
  • 0:13
    Implementing a hook is something that, up until Drupal 7,
  • 0:16
    was reserved for modules only.
  • 0:19
    In Drupal 7, though, there are a handful
  • 0:21
    of hooks that we can implement in our theme
  • 0:24
    inside of the template.php file in order
  • 0:27
    to alter how things are output on the page

Theme Alter Hooks for CSS and JavaScript


There are four alter hooks that are now available to the theme layer in Drupal 7. This chapter walks through two of those hooks, hook_css_alter() and hook_js_alter(). These hooks allow the theme layer to reorder, delete or replace specific CSS or JavaScript files that are being loaded by Drupal core or other contributed modules.

Additional resources: