Allow premium message pseudo-field to be hidden

Created on 19 January 2022, almost 3 years ago
Updated 10 October 2024, 2 months ago

Problem/Motivation

When you move the `premium_message` pseudo-field to the hidden section of the (selected) premium teaser view mode, the message is still shown when displaying the node (using the premium teaser view mode).

Steps to reproduce

  1. Manage the display (of a content type) that is selected as the premium teaser view mode and move the "Premium message" pseudo-field to disabled.
  2. View a node (of that content type) that has the premium checkbox checked (and rendered using the indicated premium teaser view mode) and verify that the (default) premium message is still shown.

Proposed resolution

Change the `function nopremium_node_view()` implementation and check using the EntityViewDisplayInterface whether the `premium_message` pseudo-field is attached to the display.

Remaining tasks

  1. Mimic the changes to test scenario's

User interface changes

N.a.

API changes

N.a.

Data model changes

N.a.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇳🇱Netherlands watergate

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • 🇳🇱Netherlands megachriz

    To fix the tests, I configured the 'Premium message' psuedo field to be displayed by default - but it gets hidden when the message is not applicable. That is when:

    • The node is not premium.
    • The current user has the permission to access the full node.
    • The view mode got overridden with the teaser view mode.
  • 🇳🇱Netherlands megachriz

    Needs a config update so that the premium message gets displayed on the existing teaser view mode.

  • 🇳🇱Netherlands megachriz

    It would be good to have tests for the post update.

    Also, we could choose to still hide the message by default and only enable it for the teaser view mode upon install.

Production build 0.71.5 2024