Drupal 7 Automatic Nodetitles Module
The Drupal 7 Automatic Nodetitles module is a useful Drupal module that allows you to easily hide the page title field when creating content. On top of that, it allows you to create Drupal token based patterns for filling in the default for the hidden title field.
In this episode you will learn:
- How the Drupal 7 Auto Nodetitles module can be used to hide the title field on a node creation page.
- How to use the Drupal 7 token module to create patterns for the Drupal Auto Nodetitles module.
Welcome to another Daily Dose of Drupal, today we’re on Episode Number 27 and I am Shane as always, you can follow me on Twitter @smthomas3, also check out codekarate.com.
Today we’re going through a really easy one and one that you may already be familiar with but if not, tune in because we are going over Automatic Node Titles and this is the module that I use a lot in Drupal 6 and I’ve still found quite a few uses for it in Drupal 7.
So there may be certain instances where you need to hide a Title Field and in Drupal that can be done very easily with the Auto Node Titles or Automatic Node Titles Module. So let’s start by creating a content type and we’re just going to create a quick example and we’re just going to call this Hide Title just a quick example, we’ll go ahead and we’ll save this and in this Hide Title we’re going to go to Manage Fields and we’re going to go ahead and add a Test Field 1 which is going to be a Text Field, we’ll go ahead and keep everything to default and we also have a body field and we’ll just leave that the way it is just to keep it real simple, the next step is to install this Auto Node Title Module.
So I’m going to come in to Drush and I’m going to say Drush download Auto Node Title and then I’m also going to install it. And one thing you want to make sure is that you’re mostly going to want the Token Module on here because that’s going add in some replacement patterns that you’re going to want to be able to use. So if I come over here to the Modules page you can see we already have it installed but it says it allows hiding of the Content Title Field and Automatic Title Creation and that’s just exactly what we want.
So we’re going to come back to the Edit tab on our new content type and you’ll see right at the top there’s an Automatic Title Generation. You can go ahead and say Automatically generate the title if you leave the title field empty, so in that case; if you … it’ll show the title field and if you leave a blank it’ll automatically put in whatever pattern you had here into the Title Field.
The other option is to automatically generate the title field and hide the title field. So let’s go ahead and do that and let’s just put the pattern for the title as test for now, we’ll go ahead and save it, now if we come over here and add content and we go to add a Hide Title you’ll notice there is Node Title Field, if you notice there is no title field. The next step is now to download the Token Module and this will allow us to use different replacement patterns.
So I’m going to download and enable the Token Module, if we come back here and go to our Modules page and we go ahead and look for Token, you can see that it is now installed, now if we come back to the Edit on our Hide Title Content Type, if you’ll notice on Automatic Title Generation there is a listing of different patterns that you can use so you could go ahead and you could use the current date for instance and let’s also say I want to use a value from one of the fields that we added which was … I believed that if we come back here; was Test Field 1.
So if we look for that you’re going to see Test Field 1 and we should be able to go ahead and select this one here and now let’s go ahead and test it out, I’ll save this and I’m going to go to Add Content Hide Title, you can see there is no title field, go ahead and save it and you can see it says the current date and it uses … this is a test from that Text Field that … or this Text Field that I entered in here and that’s really all there is to it. It’s a super simple module but it has many practical use cases.
There’s a lot of different times if you use Content Types to do more than just a basic age where you’re building some type of web application where you maybe need … you’re building a Customer Relationship Management System in Drupal or a bug tracking system or many different things like that where you may actually not need the title field to show up, you may want to automatically create the title field from a list of other fields on that content type.
So this was nice and short but I do think it was very useful and we’ll be back again tomorrow with a whole another topic. Thanks for watching the Daily Dose of Drupal.



Discussions
Automatic Entity Label
There is now a module that works with all Entities not just nodes. Automatic Entity Labels
help
Hi, with the Automatic Nodetitles module enabled, I can no longer set the node:body:value using Rules. Has anyone been able to set the node body value using PHP? If so, please share your approach. Thanks!
Post new comment