Problem/Motivation

Immediately upon enabling the module in Drupal 9.3.12 with PHP 8.0.18:

php Error AssertionError: Cannot load the "view" entity with NULL ID. in assert() (line 295 of
/app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php) #0 /app/web/core/lib/Drupal/Core/Entity/Ent
php Warning Warning: Undefined array key "#parent_view" in views_fields_on_off_preprocess_views_exposed_form() (line 43 of
/app/web/modules/contrib/views_fields_on_off/views_fields_on_off.module) #0 /

Steps to reproduce

Enable the module, then navigate to a View that does not implement the module, such as /admin/reports/status.

Proposed resolution

At line 43 of views_field_on_off.module, add

  if (!isset($variables['form']) || !isset($variables['form']['#parent_view'])) {
    return;
  }

Remaining tasks

make a patch.

Comments

BenStallings created an issue. See original summary.

benstallings’s picture

Status: Active » Needs review
StatusFileSize
new618 bytes

Here's a patch.

andileco’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.