There are several oddities in the Node views data, which show up in the user interface when you go to add fields to a view:

a) Two fields are missing help: Sticky and Promoted.
Views field add - missing help
Views field add - missing help

b) There are several pairs of fields that appear twice in the list with no obvious reason why they're different. The reason is that the fields appear in two tables, such as node and node_field_data. I think we need to either remove one field or distinguish between them by changing the field name or help. Here are two examples:
Views field add - double field
Views field add - double field

I'm pretty sure these are just coming from the base EntityViewsData. Actually I'm not sure why the node type field is in the entity field data table anyway (I don't think you can change it on a per-translation basis ?!?), so for now I'm putting this in the Views component because we may need to fix it there.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Are we sure that we don't have an issue for point b)?
We (plach, I) discussed that problem for quite a while. There are issues like the problem that they affect the potential query,
so we maybe should not tackle that in an issue which takes care about usability.

jhodgdon’s picture

I don't know if there is another issue or not, sorry.

What we did for some of the other duplicated fields that appear in more than one table, such as Language fields, si we changed the Title and Description of these based on which table it is in. This is in EntityViewsData, for instance:

  protected function processViewsDataForLanguage($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name) {
    // Apply special titles for the langcode field.
    if ($field_definition->getName() == $this->entityType->getKey('langcode')) {
      if ($table == $this->entityType->getDataTable() || $table == $this->entityType->getRevisionDataTable()) {
        $views_field['title'] = $this->t('Translation language');
      }
      if ($table == $this->entityType->getBaseTable() || $table == $this->entityType->getRevisionTable()) {
        $views_field['title'] =  $this->t('Original language');
      }
    }
  }

We may just need to do this more generically, for any fields that are duplicated between base table and data table. Either that or maybe remove duplicated fields from the base table if they also appear in the data table, aside from Language, which actually has a different meaning on each... but things like Node ID and Content Type don't.

Either that or we will have to do it case-by-case in the specific *ViewsData classes. :(

Lendude’s picture

a) is related to #2424065: Remove "Error: missing help" messages, should you show help error messages when the title really doesn't need any additional help (like the case seems to be for front and sticky)

dawehner’s picture

Status: Active » Fixed

I think we are done with this oddity now.

jhodgdon’s picture

Status: Fixed » Closed (duplicate)

Indeed. (2) was fixed in the base class by removing the dups, and (1) was fixed on the issue mentioned in #3. So really this is a duplicate.