Code works only for the view mode "full"

Created on 12 June 2023, about 2 years ago

Problem/Motivation

This line of code if ($readTypeConfig && !$entity->in_preview && $view_mode === "full") make it clear that entity is being recorded as read only if it's full view mode is browsed. However, it is possible to create custom view modes that are used instead of full.

Steps to reproduce

Install the 1.3 version and select a Content type to track, e.g. Service.
Create a view mode called. e.g. custom_full and programmatically set is as a default for the Service.
Browse Service nodes and see a table empty.

Proposed resolution

The module should expose available view modes for selection.

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

🇫🇮Finland YevKo Espoo

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

Merge Requests

Comments & Activities

  • Issue created by @YevKo
  • The code works as intended, so I don't think it's a bug report. I'll switch the issue to a feature request and will look into implementing it.

  • Status changed to Needs review almost 2 years ago
  • Added a view mode checkbox selection. You can select multiple view modes, by default no view mode is selected so now if you ever want to temporarily remove some entity type you can use that.

    I've run the automated test locally and did a bit of testing by hand and it looks like everything works fine.

  • Pipeline finished with Failed
    over 1 year ago
    Total: 212s
    #28385
  • Rebased the issue fork. The tests are failing because of an issue being fixed in 📌 Drupal 10 Fix deprecations in tests Needs review .

  • Status changed to Needs work over 1 year ago
  • Pipeline finished with Failed
    over 1 year ago
    Total: 352s
    #30085
  • Status changed to Needs review over 1 year ago
  • Since it's a new functionality, decided to add an automated test for it. The new test is passing, the old one is still failing for the same reason as mentioned before.

  • First commit to issue fork.
  • First commit to issue fork.
  • Pipeline finished with Success
    4 days ago
    Total: 154s
    #536019
  • 🇸🇮Slovenia deaom

    Tested the changes with a clean Drupal 11 install and the latest MR. The code adds the newly created custom view mode display in the configuration settings of a recently read settings page and can be selected. As before, multiple view modes can be selected. As automatic tests are passing, tested manually:

    1. Created a new view mode custom full
    2. In recently read settings applied the custom full view mode display for article.
    3. Added 2 content type articles
    4. Added the recently read block
    5. Checked there is nothing displayed there when visiting newly created articles in their default view mode
    6. Programmatically updated the default full view mode to display the custom full for article content type
    7. Visited the articles and they were displayed in the block.

    I'm marking this change as RTBC as the changes added do not affect the functionality, but fell free to change it to needs review if needed.

  • 🇸🇮Slovenia jernejmramor

    Since this was RTBC and I think it would be a nice feature to have in this module I'm merging this into development branch and this will get included into the next release. Marking this issue as fixed for now, will close it after it gets released.

Production build 0.71.5 2024