In creating a block with a suggested citations I ran into a number of challenges.
- The creator/owner field is a referenced field with multiple persons possible. I could get a list of names but it was hard to find a way to get a row of comma separated names. I probably could have created a view mode with code but instead I found a module - views merge rows which will merge the rows into a row. It already has a verison for Drupal 8 so would be good for upgrading.
- I needed to reformat the names last, first initial. Here I just need to make a custom name format.
So here are the steps:
1. Install module views merge rows via: drush en views_merge_rows -y |
2. Create a custom name format in admin/config/regional/name I called mine Citation with a format of LG((f-,)+ (x-.)+ (y-.)) |
3. Create a block view which I called Data set citation (admin/structure/views/add) which will be filtered to data set. Finished Block View: |
Before adding the Name field add a Contextual filter on Node Id: |
Relationship of Entity Reference on field_person_creator: |
Configure field Name using the relationship: |
Configure DOI |
Configure Publication Date to add a period. |
Configure format of fields setting to Inline Fields |
Set the merge row |
4. Once view is created add a Display Suite block field (admin/structure/ds/fields) using the view with layout "show only block content" called "Citation". |
5. Now edit structure of data set -> Manage Display (admin/structure/types/manage/data_set/display) and create a group field I called "group_citation" of format "Fieldset". Edit the label to add a description like "Published on EDI/LTER Data Portal" and enable it in Header. |
6. Enable the block field "Citation" and place under the group_citation. |