Does C-E let me create a View Mode?

Created on 7 July 2023, 12 months ago
Updated 25 April 2024, about 2 months ago

I maybe missing a key part of the puzzle.

D10 - using civicrm_entity reference field on a node to select the contact.

I can see on the content type display I can set this to entity id, or rendered entity

and if i choose rendered entity and enable 'contact' as a c_e entity i can then opt for which fields i want for the display, but that seems to be a one-size fits all solution system-wide.

if i want something more nuanced, ie one 'display' for this situation and another display for some other context, how do i approach this?

Should I expect to find c_e as an option at admin/structure/display-modes/view (since it is an 'entity') or is something else required before I could do so.

The alternative solution would be to use the cid from my c_e reference field for the contact ID, and use as a contextual filter in a View and then use 'something' to drop the View on to the node display instead. but that seems a bit of a long way round.

πŸ’¬ Support request
Status

Closed: works as designed

Version

4.0

Component

User interface

Created by

πŸ‡³πŸ‡ΏNew Zealand petednz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @petednz
  • Assigned to markusa
  • πŸ‡ΊπŸ‡ΈUnited States markusa

    Hey Peter

    Yep, you can do this.

    To be able to manage display for an entity type, and create additional view modes, first you have to enable the CiviCRM Entity type at /admin/structure/civicrm-entity/settings

    Check "CiviCRM Contact" to be able to do this for contacts.

    After that you'll be able to add View display modes /admin/structure/display-modes/view/add/civicrm_contact

    Then you can navigate to the "Manage Display" page, /admin/structure/civicrm-entity/civicrm-contact/display
    After you've made a custom view module, you'll see a field set at the bottom of the page, "Custom display settings"
    Enable your new view mode
    Save, and after that you'll see a submenu item underneat the tabs to manage the fields on the new display.

    Then you can configure the entity reference field on your node type, to use that display.
    You can use different displays for different entity reference fields.

    Let me know if further questions!

  • πŸ‡³πŸ‡ΏNew Zealand petednz

    Hi Mark - thanks for responding. Odd, I already had access to

    /admin/structure/civicrm-entity/civicrm-contact/display

    but had not been seeing civicrm contact as an option at /admin/structure/display-modes/view/add.

    I am seeing it now. Not sure what was going on other than me having a blind spot. I do now so added a civicontact2 View mode

    and yes therefore now I do see Custom Display Settings option at the bottom of the 'Manage display' form with

    > Use custom display settings for the following view modes

    and my new View mode. All as expected.

    This has me worried for a bit till i decided it might be a typo

    > After you've made a custom view module

    I went on to modify my Display at admin/structure/civicrm-entity/civicrm-contact/display/civicontact2 (simply setting the Labels to Inline instead of Hidden so I can confirm I am seeing the changes)

    I go to the Content Type, Manage Display, For one of my c-e entity reference fields I set it to Rendered Entity and via the 'cog' can set it to 'rendered as civicontact2'. so far so good.

    I then go to a node of this type hoping that on refresh I will see my Labels. bingo.

    That has done all the expected. not sure how the earlier settings wasn't visible but maybe too many mirrors.

    Now I have to decide whether to persevere in this direction so that the three fields (image, name, employer) display as

    Name
    IMAGE
    Employer

    or if i continue with the Views approach I took while scratching my head on this one.

    I'll assume that the final step for managing how these fields actually display is going to be at the theme level (not my area) but happy to be put right if there is another tool I am unaware of.

    Again, appreciate your response Mark.

  • Status changed to Closed: works as designed about 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States markusa
Production build 0.69.0 2024