"Set Entity View Mode" doesn't work

Created on 29 January 2024, 11 months ago
Updated 3 February 2024, 11 months ago

Problem/Motivation

First, this is different from Set Entity View Mode https://www.drupal.org/project/eca/issues/3413762 Set Entity View Mode Active .
I want to set different view mode based on the role of users when the content is viewed.

Steps to reproduce

1. I use PREPARE CONTENT ENTITY VIEW to trigger the event;
2. I use the condition to check the role of the current users. if the role is "advanced", then display a message to user (for testing) and set the view mode to "node.special";
3. When the content is viewed, I do see the test message, but the view mode is still "default";
4. The machine name of the view mode I want to set is "node.special", but I also tried "special", still doesn't work.

I use Drupal 10.2.1 on MAC localhost, all my modules are up to date.

In addition, the test message shows up only when it is the first time to display the content, unless I cleared caches.

Do I need to install or activate certain modules to make this function work? Appreciate for any advice.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Closed: duplicate

Version

1.1

Component

Code

Created by

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

Comments & Activities

  • Issue created by @sdsc
  • 🇩🇪Germany jurgenhaas Gottmadingen

    How is this different from Set Entity View Mode Active ? It sounds like exactly the same.

    I use the condition to check the role of the current users. if the role is "advanced", then display a message to user (for testing) and set the view mode to "node.special";

    How did you do that? As far as I can tell, there is no action which allows you to set the view mode. Am I missing something?

    It looks to me, this is a duplicate of the other issue. Can you please clarify?

  • Hi, Jurgenhass, the #3413762: Set Entity View Mode is referring to 2.0.x-dev at code level to change the Entity View Mode for new feature, this one is about the function Set Entity View Mode in 1.1.4 not working.

    There is an action called "set the view mode".

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Hmm, I don't think there is an action called set the view mode. If you have one in your system, could you please tell me more about it? If I'm not wrong, there is no such action in ECA, that's why we're planning to build one from the other issue.

  • It's here: https://ecaguide.org/plugins/eca/content/actions/eca_content_set_form_di..., I see your name there.

    I think I know what is going on here. Your team is still in process to make it work, but it shows up in version 1.1.4 already (although not functioning yet). I'll wait. thank you and your team working hard to make it available! I look forward to using it in production.

  • Status changed to Closed: duplicate 11 months ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    @sdsc the action you're linking to in #5 is about Set form display, not Set Entity View Mode, those are 2 different things. The former already exists, the latter waits for someone to implement it.

Production build 0.71.5 2024