Creating a preprocess function for a theme function

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
    Creating a Preprocess Function for a Theme Function
  • 0:06
    with Joe Shindelar
  • 0:08
    In this chapter, we're
  • 0:09
    going to take a look at one of my favorite new things
  • 0:11
    about theming in Drupal 7-- the ability
  • 0:13
    to create preprocess functions for a theme functions.
  • 0:17
    What we're going to do is make some changes to how
  • 0:20
    usernames are output on the page.
  • 0:23
    If we take a look at our mock up, you can see that it's not actually
  • 0:27
    using someone's username like the name admin or something like that,

Creating a Preprocess Function for a Theme Function

Loading...

In this video we will see how we can create our own preprocess function for a theme function (not just templates). We're going to use this to display the user's full name on the site wherever the the username would normally appear. We start by creating a full name field, and then show how to get this working on our site.

Additional resources: