0

I am trying to build a View that lists People's Profiles which are referenced to a Team via a Paragraph (within that Profile) to print out the Name of the Person and other data from the Profile.

The Team content type is for representing a team, with title, picture, and description. Profile content type has a title, name, some other fields, and a paragraph with further role-based data for a team.

Profile

  • Name
  • Body
  • Role_in_Team (Paragraph):
    • Datetime_Start
    • Datetime_End
    • Role_Name
    • Team_Reference (Entity reference to a Team)
    • ...

On a Team node, a view shall show the matching profiles beneath.

I build a view Block with:

  • A contextual Filter with "ID from URL" to relate everything just to the shown team node
  • A relationship with "Team_Reference" to show only paragraphs that are referenced to (this) team (Paragraph uses Team_Reference.)
  • A relationship with "Content using Team_Reference" (with relationship "Team_Reference" within)

The view block shows the correct number of profile entries (that are referenced), but I can't get it to show the profile's names.

How do I get access the parent node's fields of the of the specific paragraph?

Sample output of the view block

This is the exported block.

uuid: 60312c0b-a7b5-4e59-9935-005b4eeec9c3
langcode: de
status: true
dependencies:
  config:
    - field.storage.node.field_geburtstag
    - field.storage.paragraph.field_bezeichnung
  module:
    - datetime
    - node
    - paragraphs
    - user
    - views_bootstrap
id: team_profile
label: Team->Profile
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
  default:
    display_plugin: default
    id: default
    display_title: Master
    position: 0
    display_options:
      access:
        type: perm
        options:
          perm: 'access content'
      cache:
        type: tag
        options: {  }
      query:
        type: views_query
        options:
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_comment: ''
          query_tags: {  }
      exposed_form:
        type: basic
        options:
          submit_button: Anwenden
          reset_button: false
          reset_button_label: Reset
          exposed_sorts_label: 'Sort by'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      pager:
        type: some
        options:
          items_per_page: 5
          offset: 0
      style:
        type: views_bootstrap_table
        options:
          grouping: {  }
          row_class: ''
          default_row_class: true
          override: 1
          sticky: 0
          caption: ''
          summary: ''
          description: ''
          columns:
            title: title
            field_geburtstag: field_geburtstag
          info:
            title:
              sortable: 0
              default_sort_order: asc
              align: ''
              separator: ''
              empty_column: 0
              responsive: ''
            field_geburtstag:
              sortable: 0
              default_sort_order: asc
              align: ''
              separator: ''
              empty_column: 0
              responsive: ''
          default: '-1'
          empty_table: 0
          responsive: 0
          bootstrap_styles:
            striped: 0
            bordered: 0
            hover: 0
            condensed: 0
      row:
        type: fields
      fields:
        title:
          id: title
          table: node_field_data
          field: title
          relationship: none
          group_type: group
          admin_label: ''
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings:
            link_to_entity: true
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          plugin_id: field
        field_geburtstag:
          id: field_geburtstag
          table: node__field_geburtstag
          field: field_geburtstag
          relationship: none
          group_type: group
          admin_label: ''
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: datetime_default
          settings:
            timezone_override: ''
            format_type: medium
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          plugin_id: field
        field_bezeichnung:
          id: field_bezeichnung
          table: paragraph__field_bezeichnung
          field: field_bezeichnung
          relationship: reverse__paragraph__field_referenz_auf_team
          group_type: group
          admin_label: ''
          label: Bezeichnung
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: true
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings: {  }
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          plugin_id: field
      filters:
        status:
          value: '1'
          table: node_field_data
          field: status
          plugin_id: boolean
          entity_type: node
          entity_field: status
          id: status
          expose:
            operator: ''
            operator_limit_selection: false
            operator_list: {  }
          group: 1
      sorts:
        created:
          id: created
          table: node_field_data
          field: created
          order: DESC
          entity_type: node
          entity_field: created
          plugin_id: date
          relationship: none
          group_type: group
          admin_label: ''
          exposed: false
          expose:
            label: ''
          granularity: second
      title: Team->Profile
      header: {  }
      footer: {  }
      empty: {  }
      relationships:
        reverse__paragraph__field_referenz_auf_team:
          id: reverse__paragraph__field_referenz_auf_team
          table: node_field_data
          field: reverse__paragraph__field_referenz_auf_team
          relationship: none
          group_type: group
          admin_label: field_referenz_auf_team
          required: false
          entity_type: node
          plugin_id: entity_reverse
        field_referenz_auf_team:
          id: field_referenz_auf_team
          table: paragraph__field_referenz_auf_team
          field: field_referenz_auf_team
          relationship: reverse__paragraph__field_referenz_auf_team
          group_type: group
          admin_label: 'field_referenz_auf_team: Inhalt'
          required: false
          plugin_id: standard
      arguments:
        nid:
          id: nid
          table: node_field_data
          field: nid
          relationship: none
          group_type: group
          admin_label: ''
          default_action: default
          exception:
            value: all
            title_enable: false
            title: All
          title_enable: false
          title: ''
          default_argument_type: node
          default_argument_options: {  }
          default_argument_skip_url: false
          summary_options:
            base_path: ''
            count: true
            items_per_page: 25
            override: false
          summary:
            sort_order: asc
            number_of_records: 0
            format: default_summary
          specify_validation: false
          validate:
            type: none
            fail: 'not found'
          validate_options: {  }
          break_phrase: false
          not: false
          entity_type: node
          entity_field: nid
          plugin_id: node_nid
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - 'user.node_grants:view'
        - user.permissions
      tags:
        - 'config:field.storage.node.field_geburtstag'
        - 'config:field.storage.paragraph.field_bezeichnung'
  block_1:
    display_plugin: block
    id: block_1
    display_title: Block
    position: 1
    display_options:
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - 'user.node_grants:view'
        - user.permissions
      tags:
        - 'config:field.storage.node.field_geburtstag'
        - 'config:field.storage.paragraph.field_bezeichnung'

2 Answers 2

2

Paragraphs are just double-layered Entity Reference fields. You want to show backwards information, to show children and grandchildren (Profiles) on Parent/Grandparent (Teams) nodes.

To show "backwards" info you need the "backwards" Relationship. "Backwards" Relationships are named slightly differently from "forward" ones, you need to recognize which of the two for a field you need to use by logic of "something referenced" or "something that is referencing".

Since you have two levels of connections you need to chain 2 "backwards" Relationships in order to get to grandchildren starting from grandparents.

First you need the backwards Relationship for the field between Team and Paragraph, you may have that already. Then you need to add another backwards Relationship, this time for the field between Profile and Paragraph, and make it use the first Relationship I mentioned to chain them.

Now Views has access to all the database tables you want. To show Profile fields add a field you want and make it use the second chained Relationship.

Your Contextual filter seems in good order, but I'm not sure about the second Relationship you mentioned, if you didn't add it for some other purpose you probably need to remove it.

1
  • Thanks. Your thoughts are helpful. I rebuild the View Step by Step and made it show the 3 Profiles on a Team, but only the first was showing its Name... After a lot of experimenting with anything that can be chosen on the relationship fields I finally reversed the order of relationships. If I am using the relationship between Profile and Paragraph first and onto that the reference between Team and Paragraph, it finally works! Thank you very much. Building such Views sometimes works out of the box and sometimes gives you headaches :-) May 5, 2021 at 5:47
-1

Following the prkos' answer, I obtained the following view block.

uuid: 60312c0b-a7b5-4e59-9935-005b4eeec9c3
langcode: de
status: true
dependencies:
  config:
    - field.storage.paragraph.field_bezeichnung
  module:
    - node
    - paragraphs
    - user
    - views_bootstrap
id: team_profile
label: Team->Profile
module: views
description: ''
tag: ''
base_table: node_field_data
base_field: nid
display:
  default:
    display_plugin: default
    id: default
    display_title: Master
    position: 0
    display_options:
      access:
        type: perm
        options:
          perm: 'access content'
      cache:
        type: tag
        options: {  }
      query:
        type: views_query
        options:
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_comment: ''
          query_tags: {  }
      exposed_form:
        type: basic
        options:
          submit_button: Anwenden
          reset_button: false
          reset_button_label: Reset
          exposed_sorts_label: 'Sort by'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      pager:
        type: none
        options:
          offset: 0
      style:
        type: views_bootstrap_table
        options:
          grouping: {  }
          row_class: ''
          default_row_class: true
          override: 1
          sticky: 0
          caption: ''
          summary: ''
          description: ''
          columns:
            title: title
            field_geburtstag: field_geburtstag
          info:
            title:
              sortable: 0
              default_sort_order: asc
              align: ''
              separator: ''
              empty_column: 0
              responsive: ''
            field_geburtstag:
              sortable: 0
              default_sort_order: asc
              align: ''
              separator: ''
              empty_column: 0
              responsive: ''
          default: '-1'
          empty_table: 0
          responsive: 0
          bootstrap_styles:
            striped: 0
            bordered: 0
            hover: 0
            condensed: 0
      row:
        type: fields
      fields:
        title_1:
          id: title_1
          table: node_field_data
          field: title
          relationship: none
          group_type: group
          admin_label: ''
          label: Titel
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: true
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings:
            link_to_entity: true
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          entity_type: node
          entity_field: title
          plugin_id: field
        field_bezeichnung:
          id: field_bezeichnung
          table: paragraph__field_bezeichnung
          field: field_bezeichnung
          relationship: field_vereinsaufgaben
          group_type: group
          admin_label: ''
          label: Bezeichnung
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: true
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: string
          settings: {  }
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          plugin_id: field
      filters:
        status:
          value: '1'
          table: node_field_data
          field: status
          plugin_id: boolean
          entity_type: node
          entity_field: status
          id: status
          expose:
            operator: ''
            operator_limit_selection: false
            operator_list: {  }
          group: 1
      sorts: {  }
      title: Team->Profile
      header: {  }
      footer: {  }
      empty: {  }
      relationships:
        field_vereinsaufgaben:
          id: field_vereinsaufgaben
          table: node__field_vereinsaufgaben
          field: field_vereinsaufgaben
          relationship: none
          group_type: group
          admin_label: 'field_vereinsaufgaben: Seitenabschnitt'
          required: true
          plugin_id: standard
        field_referenz_auf_team:
          id: field_referenz_auf_team
          table: paragraph__field_referenz_auf_team
          field: field_referenz_auf_team
          relationship: field_vereinsaufgaben
          group_type: group
          admin_label: 'field_referenz_auf_team: Inhalt'
          required: true
          plugin_id: standard
      arguments:
        nid:
          id: nid
          table: node_field_data
          field: nid
          relationship: field_referenz_auf_team
          group_type: group
          admin_label: ''
          default_action: default
          exception:
            value: all
            title_enable: false
            title: All
          title_enable: false
          title: ''
          default_argument_type: node
          default_argument_options: {  }
          default_argument_skip_url: false
          summary_options:
            base_path: ''
            count: true
            items_per_page: 25
            override: false
          summary:
            sort_order: asc
            number_of_records: 0
            format: default_summary
          specify_validation: false
          validate:
            type: none
            fail: 'not found'
          validate_options: {  }
          break_phrase: false
          not: false
          entity_type: node
          entity_field: nid
          plugin_id: node_nid
      display_extenders: {  }
      use_ajax: false
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - 'user.node_grants:view'
        - user.permissions
      tags:
        - 'config:field.storage.paragraph.field_bezeichnung'
  block_1:
    display_plugin: block
    id: block_1
    display_title: Block
    position: 1
    display_options:
      display_extenders: {  }
      block_category: profil
      block_description: Team->Profile
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - 'user.node_grants:view'
        - user.permissions
      tags:
        - 'config:field.storage.paragraph.field_bezeichnung'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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