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.

Altering variables with preprocess functions

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:02
    Altering Variables with Preprocess Functions
  • 0:06
    with Michelle Lauer
  • 0:07
    In this chapter, we're
  • 0:09
    going to talk about preprocess functions in template.php.
  • 0:13
    We are going to print out all available variables,
  • 0:17
    and then change one of them.
  • 0:19
    So here's the scenario.
  • 0:21
    My designer has told me that the site's slogan that is currently
  • 0:26
    printed under the site name needs to be
  • 0:29
    displaying a random value instead.

Altering Variables with Preprocess Functions


In this video we introduce the template.php file and create our first preprocess function. We explain what the preprocess hooks are and how to name the function properly, then we show a list of existing variables, and how to modify one of those existing variables.

Additional resources: