It’s fairly common to replace the title field in Drupal.
There are many possible reasons to replace the title, but most of them come down to this … the title field is not very flexible.
To take just one example, imagine that you’re adding a directory of your staff members to your site. Presumably, you’d like the person’s name to be the title of each page. However, because the title field only consists of a text field with 255 characters, you can’t have close control over what people enter. The solution is to replace the default title with specific “First Name” and “Last Name” fields.
So, here’s how to automatically generate titles in Drupal 7.
Step 1: Install
Step 2: Set Up Each Content Type
- Go to Structure > Content types
- Look for the automatic title generation area as in the image below
- You’ll be able to use tokens to automatically replace the title
- In the example below, we’re completely hiding the title field. If we choose the bottom radio button, the title field would be available to users and our tokens would only work if the title field isn’t used.
- In the image below, we’re automatically replacing the title with the First name and Last name fields.
Step 3: Create the Content
- Click Add content and create an example of your content type
- Notice that the title field is completely missing
- Save the content and your title will be automatically generated: