diff --git a/core/modules/taxonomy/src/TermViewsData.php b/core/modules/taxonomy/src/TermViewsData.php index d0bf07397e..9c6f85e9a4 100644 --- a/core/modules/taxonomy/src/TermViewsData.php +++ b/core/modules/taxonomy/src/TermViewsData.php @@ -239,24 +239,8 @@ public function getViewsData() { ), ); - $data['taxonomy_term__parent']['parent_target_id'] = array( - 'title' => $this->t('Parent term'), - 'help' => $this->t('The parent term of the term. This can produce duplicate entries if you are using a vocabulary that allows multiple parents.'), - 'relationship' => array( - 'base' => 'taxonomy_term_field_data', - 'field' => 'parent_target_id', - 'label' => $this->t('Parent'), - 'id' => 'standard', - ), - 'filter' => array( - 'help' => $this->t('Filter the results of "Taxonomy: Term" by the parent pid.'), - 'id' => 'numeric', - ), - 'argument' => array( - 'help' => $this->t('The parent term of the term.'), - 'id' => 'taxonomy', - ), - ); + $data['taxonomy_term__parent']['parent_target_id']['help'] = $this->t('The parent term of the term. This can produce duplicate entries if you are using a vocabulary that allows multiple parents.'); + $data['taxonomy_term__parent']['parent_target_id']['argument']['id'] = 'taxonomy'; return $data; } diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index 2c8e6ccdd6..5a3c2584b5 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -91,6 +91,10 @@ function taxonomy_update_8203() { $path = "display.$display_id.display_options.relationships.parent.table"; if (!empty($table = $view->get($path)) && $table == 'taxonomy_term_hierarchy') { $view->set($path, 'taxonomy_term__parent'); + + $path = "display.$display_id.display_options.relationships.parent.field"; + $view->set($path, 'parent_target_id'); + $changed = TRUE; } } diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 61def5acd4..5bce2c101b 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -366,18 +366,16 @@ protected function mapFieldDefinition($table, $field_name, FieldDefinitionInterf $field_schema = $this->getFieldStorageDefinitions()[$field_name]->getSchema(); $field_definition_type = $field_definition->getType(); + // Add all properties to views table data. We need an entry for each // column of each field, with the first one given special treatment. // @todo Introduce concept of the "main" column for a field, rather than // assuming the first one is the main column. See also what the // mapSingleFieldViewsData() method does with $first. - $multiple = (count($field_column_mapping) > 1); $first = TRUE; foreach ($field_column_mapping as $field_column_name => $schema_field_name) { - $views_field_name = ($multiple) ? $field_name . '__' . $field_column_name : $field_name; - $table_data[$views_field_name] = $this->mapSingleFieldViewsData($table, $field_name, $field_definition_type, $field_column_name, $field_schema['columns'][$field_column_name]['type'], $first, $field_definition); - - $table_data[$views_field_name]['entity field'] = $field_name; + $table_data[$schema_field_name] = $this->mapSingleFieldViewsData($table, $field_name, $field_definition_type, $field_column_name, $field_schema['columns'][$field_column_name]['type'], $first, $field_definition); + $table_data[$schema_field_name]['entity field'] = $field_name; $first = FALSE; } }