Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 314013

Notice: Trying to access array offset on value of type null in Drupal\views\Plugin\views\display\EntityReference->query()

$
0
0

Problem/Motivation

With php 7.4 I get this notice
Notice: Trying to access array offset on value of type null in Drupal\views\Plugin\views\display\EntityReference->query() (line 196 of /var/www/html/web/core/modules/views/src/Plugin/views/display/EntityReference.php) when I try to programmatically execute a views with entity_reference display

Steps to reproduce

I have a code like this

  /** @var \Drupal\views\ViewExecutable $view */
  $view = Views::getView($views_id);
  $view->execute($views_display_id);

inside a hook_form_views_exposed_form_alter() implementations. The "$views_display_id" is an entity_reference display id.

Proposed resolution

Set default values for entity_reference_options for the entity_reference views display in the code. The default options should match the default values that would typically be applied if the entity_reference view is executed under normal circumstance, i.e. through Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::getReferenceableEntities().

Remaining tasks

User interface changes

none

API changes

default values set for entity_reference_options for the entity_reference views display

Data model changes

none

Release notes snippet

TBD


Viewing all articles
Browse latest Browse all 314013

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>