Problem/Motivation

In NodeViewsData::getViewsData(), $data['node_field_revision']['langcode']['help'] is set twice.

  $data['node_field_revision']['langcode']['help'] = $this->t('The language the original content is in.');
  $data['node_field_revision']['table']['wizard_id'] = 'node_field_revision';
  $data['node_field_revision']['status']['filter']['label'] = $this->t('Published');
  $data['node_field_revision']['langcode']['help'] = $this->t('The language of the content or translation.');
  $data['node_field_revision']['link_to_revision'] = [
    'field' => [
      'title' => $this->t('Link to revision'),
      'help' => $this->t('Provide a simple link to the revision.'),
      'id' => 'node_revision_link',
      'click sortable' => FALSE,
    ],
  ];

Proposed resolution

Remove one of the lines setting $data['node_field_revision']['langcode']['help'] .

Issue fork drupal-3264987

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Pasqualle created an issue. See original summary.

pasqualle’s picture

Issue summary: View changes
marciaibanez’s picture

Assigned: Unassigned » marciaibanez

marciaibanez’s picture

Assigned: marciaibanez » Unassigned
Status: Active » Needs review

I removed the mentioned line and opened a MR, kindly review it :)

pasqualle’s picture

Status: Needs review » Reviewed & tested by the community

thank you

avpaderno’s picture

Title: Dead code » $data['node_field_revision']['langcode']['help'] is set twice
avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

Issue summary: View changes
avpaderno’s picture

Status: Reviewed & tested by the community » Needs work

The help string left in the code ('The language of the content or translation.) doesn't make much sense: If I translate a node, the original node and the translation cannot use the same language.
The language the original content is in. makes more sense, even if I would write The original content language.

We should probably check which one was supposed to stay. This means finding in which issues those literal strings where introduced and see if the issue was supposed to remove one of the strings.

longwave’s picture

'The language of the content or translation.' was originally added in #2320521: Follow-up: Node language views filters need label adjustments

'The language the original content is in.' was then separately added later in #2429447: Use data table as views base table, if available., but it wasn't spotted that the help text already existed.

Amrita05’s picture

StatusFileSize
new748 bytes

Commenting out line 227
// $data['node_field_revision']['langcode']['help'] = $this->t('The language of the content or translation.');

avpaderno’s picture

@longwave Thank you for looking up!

I take we should keep 'The language the original content is in.', or is there any reason for using the other string?

avpaderno’s picture

Status: Needs work » Needs review
StatusFileSize
new889 bytes
shashwat purav’s picture

The patch #14 applied successfully to 9.4.x branch.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

asishsajeev’s picture

#14 patch applied successfully.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

#14 looks fine to me.

We cannot write a test for this, as the duplicate array key is in the same method.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x and cherry-picked back through to 9.5.x, thanks!

  • catch committed 30d114c on 10.0.x
    Issue #3264987 by marciaibanez, apaderno, Pasqualle, longwave: $data['...
  • catch committed 5661bc4 on 10.1.x
    Issue #3264987 by marciaibanez, apaderno, Pasqualle, longwave: $data['...
  • catch committed 4f3b578 on 9.5.x
    Issue #3264987 by marciaibanez, apaderno, Pasqualle, longwave: $data['...
asishsajeev’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.