Problem/Motivation

Now in \Drupal\Core\Entity\Plugin\EntityReferenceSelection\SelectionBase the plural name for node and taxonomy term bundles are hardcoded.

Proposed resolution

Override that name in the descendant implementation and remove the hardcoding.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because the current code is not broken.
Prioritized changes The main goal of this issue is to remove code fragility (unneeded hardcoding in a base class) in the selection plugins.
Disruption No disruption.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

claudiu.cristea’s picture

Status: Active » Needs review
FileSize
2.93 KB

Patch.

amateescu’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: +Quickfix

Since we (still) don't have an easy way to get the plural label of an entity type (i.e. #1850080: Entity type labels lack plurality, cannot generate UI text based on label if plural is needed), I think we have to keep this hardcoding in ER selection handlers and it makes sense to do it in the specific selection handlers.

Also added a beta evaluation to the issue summary.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1: remove_node_taxonomy-2452957-1.patch, failed testing.

claudiu.cristea’s picture

FileSize
602 bytes
3.19 KB

Ooops! :)

amateescu’s picture

Status: Needs work » Reviewed & tested by the community

Yep, brain code-parser didn't spot that :/

The last submitted patch, 1: remove_node_taxonomy-2452957-1.patch, failed testing.

  • webchick committed c9b2530 on 8.0.x
    Issue #2452957 by claudiu.cristea: Remove node...
webchick’s picture

Status: Reviewed & tested by the community » Fixed
+++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
@@ -124,18 +124,9 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
-      $target_bundles_title = $this->t('Bundles');
...
-        '#title' => $target_bundles_title,
+        '#title' => $this->t('Bundles'),

Yikes. :\ Didn't realize we were exposing that confusing word in the UI anywhere, but I guess it's a pre-existing condition.

Anyway, this seems fine. It reduces fragility and doesn't break anything.

Committed and pushed to 8.0.x. Thanks!

Status: Fixed » Closed (fixed)

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