0

I would appreciate suggestion for this common scenario in Drupal 8, which may be different to how I do it in Drupal 6. I don't want to do any programming.

I have two content types: (1) Articles (title, author, body) (2) Authors (First name, Surname, Biography). Authors are not users.

When adding a new article, I want the option to select either (a) An existing author from a list, or (b) Add a new author to the list, and select it.

When displaying the article, I want to see the author's First Name and Surname, and optionally a Biography teaser, and then the body of the article.

2

Enable the Entity Reference module that is the part of drupal 8 core. Create the two content types.

I have two content types: (1) Articles (title, author, body) (2) Authors (First name, Surname, Biography). Authors are not users.

When adding a new article, I want the option to select either (a) An existing author from a list, or (b) Add a new author to the list, and select it.

Add a entity reference field in the Articles content type. Go to Home Administration Structure(admin/structure/types) click on Manage fields in front of Article content type.Add a new field(Authors) and choose its field type to be Entity reference and after save, The field configuration screen will open.Choose "Type of item to reference" to Content. Then on the next screen choose the reference type(authors content type).

When displaying the article, I want to see the author's First Name and Surname, and optionally a Biography teaser, and then the body of the article.

There are several options to do so :

1)Load the authors entity in articles template and display its result like that.

2)Use the Display suite module which is still has alpha available.

3)Create the view block which displays the author information like you want to show.and embed this view in your node article template.

4)Go to Manage Display of that content type(admin/structure/types/manage/article/display) and use a separate display mode to do so.

5)etc....

I would suggest to use the Display suite because I love to use it as it made my life easier at many places.

-1

This module: https://www.drupal.org/project/entityreference is the way to go in D7. D8 has only a dev release: https://www.drupal.org/node/1246440/release?api_version%5B%5D=7234, so it might be buggy.

For displaying the correct content of the author, you should use Display Suite: https://www.drupal.org/project/ds. Again, be carefull, D8 modules might be buggy.

  • Entity Reference is the part of the Drupal 8 Core. – Naveen Valecha Nov 21 '14 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.