diff --git a/core/modules/views/src/Plugin/views/HandlerBase.php b/core/modules/views/src/Plugin/views/HandlerBase.php index 0d4f798..e277ac2 100644 --- a/core/modules/views/src/Plugin/views/HandlerBase.php +++ b/core/modules/views/src/Plugin/views/HandlerBase.php @@ -709,7 +709,9 @@ public function getEntityType() { // If the user has configured a relationship on the handler take that into // account. if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') { - $views_data = $this->getViewsData()->get($this->view->relationship[$this->options['relationship']]->table); + $relationship = $this->displayHandler->getOption('relationships')[$this->options['relationship']]; + $table_data = $this->getViewsData()->get($relationship['table']); + $views_data = $this->getViewsData()->get($table_data[$relationship['field']]['relationship']['base']); } else { $views_data = $this->getViewsData()->get($this->view->storage->get('base_table')); diff --git a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php index bdad87b..d6bca7e 100644 --- a/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php +++ b/core/modules/views_ui/src/Form/Ajax/ConfigHandler.php @@ -52,6 +52,7 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + /** @var \Drupal\views\Entity\View $view */ $view = $form_state->get('view'); $display_id = $form_state->get('display_id'); $type = $form_state->get('type'); @@ -128,6 +129,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { // skips submitting the form. $executable->setHandlerOption($display_id, $type, $id, 'relationship', $rel); $save_ui_cache = TRUE; + // Re-initialize with new relationship. + $item['relationship'] = $rel; + $handler->init($executable, $executable->display_handler, $item); } $form['options']['relationship'] = array(