Error when accessing a preview link if enabled_entity_types configuration is missing

Created on 4 April 2024, 8 months ago
Updated 5 April 2024, 7 months ago

Problem/Motivation

Error when accessing a preview link if enabled_entity_types configuration is missing.
TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() (line 60 of /var/www/html/web/modules/contrib/preview_link/src/Access/PreviewEnabledAccessCheck.php).

This can be caused by the settings form removing enabled_entity_types from the configuration.

Steps to reproduce

On the settings form, uncheck all entity types and click "Save configuration"

Proposed resolution

  • Alter the submit handler so enabled_entity_types is not removed from the configuration if no entities are selected.
  • Fallback to empty array in PreviewEnabledAccessCheck if the configuration is missing.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.1

Component

Code

Created by

🇬🇧United Kingdom polynya

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024