🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
This patch restores the original else branch that is still required.
else {
$views_data = $this->getViewsData()->get($this->view->storage->get('base_table'));
}
🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
Patch 12 is incorrect.
Rolled patch 13 against original file.
🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
Rolled a patch.
🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
Credit for this snippet goes to https://www.drupal.org/u/bradtreloar → from https://www.drupal.org/australian-competition-and-consumer-commission-accc → and I modified the issue description with it.
$relationships = $this->displayHandler->getOption('relationships');
if(isset($relationships[$this->options['relationship']])) {
$relationship = $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'));
}
🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
🐛 | Drupal core | Removing a relationship that is used by a filter can prevent access to editing a view
🇦🇺Australia merlin06
Preserving the original code
/**
* {@inheritdoc}
*/
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') {
$relationships = $this->displayHandler->getOption('relationships');
if(isset($relationships[$this->options['relationship']])) {
$relationship = $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'));
}
}
else {
$views_data = $this->getViewsData()->get($this->view->storage->get('base_table'));
}
if (isset($views_data['table']['entity type'])) {
return $views_data['table']['entity type'];
}
else {
throw new \Exception("No entity type for field {$this->options['id']} on view {$this->view->storage->id()}");
}
}
🇦🇺Australia merlin06
merlin06 → created an issue.