< Back to Coding, Drupal 7

Fielded Content Types in Drupal

Content types are like a custom type of page that also be used to sort other pages. In this example we’re making a destination content type and then allowing another page to select what destination that page belongs to.

To make a content type, go to ‘Structure/Content Types’ and then the ‘Add content type’ button. Give it the name of ‘Destination’ and then save it.

Make some destinations by going to ‘Content/Add content’, selecting Destination and giving the title any country that you like.

To make a destination selectable in say an article, go to ‘Structure/Content Types’ and click on ‘manage fields’ next to ‘article’.¬†Under ‘Add new field’, put the label ‘destination’ in the text field, and in the ‘select a field type’ dropdown, choose ‘Entity Reference. Also choose ‘Select list’ next to it. Save and then click ‘edit’ next to the new field. Scroll down to ‘Target bundles’ and tick ‘Destination’ and save.

Now when you go to ‘Content/Add content’ to make an article you’ll now see a ‘Destination’ field with a drop down to choose which destination this article belongs to.

Leave a Reply

Your email address will not be published. Required fields are marked *