diff --git a/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/Views.php b/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/Views.php index 04c46cb..0d92cdd 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/Views.php +++ b/core/modules/views/lib/Drupal/views/Plugin/entity_reference/selection/Views.php @@ -117,7 +117,7 @@ protected function initializeView($match = NULL, $match_operator = 'CONTAINS', $ // Check that the view is valid and the display still exists. $this->view = views_get_view($view_name); - if (!$this->view->access($display_name)) { + if (!$this->view || !$this->view->access($display_name)) { throw new ViewsException('The view %view_name is no longer eligible for the %field_name field.', array('%view_name' => $view_name, '%field_name' => $this->instance['label'])); } $this->view->setDisplay($display_name); diff --git a/core/modules/views/lib/Drupal/views/Tests/EntityReference/SelectionTest.php b/core/modules/views/lib/Drupal/views/Tests/EntityReference/SelectionTest.php index 9b194a2..f3060cc 100644 --- a/core/modules/views/lib/Drupal/views/Tests/EntityReference/SelectionTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/EntityReference/SelectionTest.php @@ -62,7 +62,7 @@ public function testSelectionHandler() { 'handler_settings' => array( 'target_bundles' => array(), 'view' => array( - 'view_name' => 'entity_reference', + 'view_name' => 'test_entity_reference', 'display_name' => 'entity_reference_1', 'arguments' => array(), ), diff --git a/core/modules/views/tests/views_test_config/config/views.view.entity_reference.yml b/core/modules/views/tests/views_test_config/config/views.view.entity_reference.yml deleted file mode 100644 index 0cddf22..0000000 --- a/core/modules/views/tests/views_test_config/config/views.view.entity_reference.yml +++ /dev/null @@ -1,81 +0,0 @@ -api_version: '3.0' -base_field: nid -base_table: node -core: 8.x -description: '' -disabled: '0' -display: - default: - display_plugin: default - id: default - display_title: Master - position: '' - display_options: - access: - type: perm - cache: - type: none - query: - type: views_query - exposed_form: - type: basic - pager: - type: full - style: - type: default - row: - type: fields - fields: - title: - id: title - table: node - field: title - label: '' - alter: - alter_text: '0' - make_link: '0' - absolute: '0' - trim: '0' - word_boundary: '0' - ellipsis: '0' - strip_tags: '0' - html: '0' - hide_empty: '0' - empty_zero: '0' - link_to_node: '1' - filters: - status: - value: '1' - table: node - field: status - id: status - expose: - operator: '0' - group: '1' - sorts: - created: - id: created - table: node - field: created - order: DESC - entity_reference_1: - display_plugin: entity_reference - id: entity_reference_1 - display_title: EntityReference - position: '' - display_options: - style: - type: entity_reference - options: - grouping: { } - search_fields: - title: title - pager: - type: none - options: - offset: '0' -human_name: 'Entity reference' -module: views -name: entity_reference -tag: '' -uuid: e9b5e564-c7c7-491f-aa49-73e23ba2ae33 diff --git a/core/modules/views/tests/views_test_config/config/views.view.test_entity_reference.yml b/core/modules/views/tests/views_test_config/config/views.view.test_entity_reference.yml new file mode 100644 index 0000000..2916abe --- /dev/null +++ b/core/modules/views/tests/views_test_config/config/views.view.test_entity_reference.yml @@ -0,0 +1,79 @@ +api_version: '3.0' +base_field: nid +base_table: node +core: 8.x +description: '' +disabled: '0' +display: + default: + display_plugin: default + id: default + display_title: Master + position: '' + display_options: + access: + type: perm + cache: + type: none + query: + type: views_query + exposed_form: + type: basic + pager: + type: full + style: + type: default + row: + type: fields + fields: + title: + id: title + table: node + field: title + label: '' + alter: + alter_text: '0' + make_link: '0' + absolute: '0' + trim: '0' + word_boundary: '0' + ellipsis: '0' + strip_tags: '0' + html: '0' + hide_empty: '0' + empty_zero: '0' + link_to_node: '1' + filters: + status: + value: '1' + table: node + field: status + id: status + expose: + operator: '0' + group: '1' + sorts: + created: + id: created + table: node + field: created + order: DESC + entity_reference_1: + display_plugin: entity_reference + id: entity_reference_1 + display_title: EntityReference + position: '' + display_options: + style: + type: entity_reference + options: + grouping: { } + search_fields: + title: title + pager: + type: none + options: + offset: '0' +human_name: 'Entity reference' +name: test_entity_reference +tag: ''