diff --git a/core/modules/views/src/EntityViewsData.php b/core/modules/views/src/EntityViewsData.php index 1439bd2..47d44e8 100644 --- a/core/modules/views/src/EntityViewsData.php +++ b/core/modules/views/src/EntityViewsData.php @@ -225,7 +225,11 @@ 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. + // 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) { @@ -260,6 +264,8 @@ protected function mapSingleFieldViewsData($table, $field_name, $field_type, $co $views_field = array(); // Provide a nicer, less verbose label for the first column within a field. + // @todo Introduce concept of the "main" column for a field, rather than + // assuming the first one is the main column. if ($first) { $views_field['title'] = $field_definition->getLabel(); } @@ -276,9 +282,7 @@ protected function mapSingleFieldViewsData($table, $field_name, $field_type, $co // @todo Allow field types to customize this. // @see https://www.drupal.org/node/2337515 switch ($field_type) { - // Special case a few field types. - case 'timestamp': case 'created': case 'changed': @@ -367,8 +371,10 @@ protected function mapSingleFieldViewsData($table, $field_name, $field_type, $co * The field definition. * @param array $views_field * The views field data. + * @param string $field_column_name + * The field column being processed. */ - protected function processViewsDataForLanguage($table, FieldDefinitionInterface $field_definition, array &$views_field) { + protected function processViewsDataForLanguage($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name) { // Apply special titles for the langcode field. if ($field_definition->getName() == 'langcode') { if ($table == $this->entityType->getDataTable() || $table == $this->entityType->getRevisionDataTable()) { @@ -389,8 +395,10 @@ protected function processViewsDataForLanguage($table, FieldDefinitionInterface * The field definition. * @param array $views_field * The views field data. + * @param string $field_column_name + * The field column being processed. */ - protected function processViewsDataForEntityReference($table, FieldDefinitionInterface $field_definition, array &$views_field) { + protected function processViewsDataForEntityReference($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name) { // @todo Should the actual field handler respect that this just renders a // number? @@ -432,7 +440,7 @@ protected function processViewsDataForEntityReference($table, FieldDefinitionInt * Processes the views data for a text field with formatting. * * @param string $table - * The table the language field is added to. + * The table the field is added to. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The field definition. * @param array $views_field