Remove warning when have a view on multiple pages that somehow sets the row_index

Created on 12 March 2024, 9 months ago
Updated 31 August 2024, 4 months ago

Problem/Motivation

If you have a view that you use as an embed (programmatic) more than once on the same page, and somehow a module sets the row_index or fails to set the row_index, a warning is set:

Warning: Undefined property: Drupal\views\ViewExecutable::$row_index in Drupal\views\Plugin\views\field\EntityField->prepareItemsByDelta() (line 737 of core/modules/views/src/Plugin/views/field/EntityField.php).

Drupal\views\Plugin\views\field\EntityField->prepareItemsByDelta(Array) (Line: 882)
Drupal\views\Plugin\views\field\EntityField->getItems(Object) (Line: 677)

Steps to reproduce

In this case, using the calendar_view with smart_date. Create a calendar view with at least one other normal date and a smart date. In this case have two normal dates and one smart date. Then programmatically add the view as a block on a page using layout builder. Then add a second block and the warning message appears. Note that if you do not include smart dates on the view it is not thrown. Look through both calendar view and smart date issues queues and could not find anything related to this.

Proposed resolution

Will be supplying a patch to fix this.

🐛 Bug report
Status

Closed: works as designed

Version

9.5

Component
Views 

Last updated about 3 hours ago

Created by

🇨🇦Canada ebremner

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

Comments & Activities

  • Issue created by @ebremner
  • 🇨🇦Canada ebremner

    Supplying patch to fix.

  • Status changed to Needs review 9 months ago
  • Status changed to Needs work 9 months ago
  • The Needs Review Queue Bot tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • Status changed to Postponed: needs info 9 months ago
  • Drupal 9 is not supported.

  • 🇦🇺Australia pameeela

    As already noted, Drupal 9 is no longer supported. If this issue can be reproduced in Drupal 10 or 11, please note this.

    If more information is not provided within the next three months, this issue will be closed. Or if it cannot be reproduced outside of version 9, it will also be closed.

  • Status changed to Closed: works as designed 4 months ago
  • 🇳🇿New Zealand quietone

    Since we need more information to move forward with this issue, and it has not been supplied and Drupal 9 is EOL. I am closing this issue.

    If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', updating the Version and and providing complete steps to reproduce the issue (starting from "Install Drupal core").

    Thanks!

Production build 0.71.5 2024