diff --git a/core/lib/Drupal/Core/Entity/Plugin/Condition/Deriver/EntityBundle.php b/core/lib/Drupal/Core/Entity/Plugin/Condition/Deriver/EntityBundle.php index bde85e1805..f44d09b6bb 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/Condition/Deriver/EntityBundle.php +++ b/core/lib/Drupal/Core/Entity/Plugin/Condition/Deriver/EntityBundle.php @@ -3,7 +3,6 @@ namespace Drupal\Core\Entity\Plugin\Condition\Deriver; use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Plugin\Context\ContextDefinition; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; @@ -57,7 +56,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { // is in. if ($entity_type->hasKey('bundle') && $entity_type_id != 'node') { $this->derivatives[$entity_type_id] = $base_plugin_definition; - $this->derivatives[$entity_type_id]['label'] = $this->getEntityBundleLabel($entity_type); + $this->derivatives[$entity_type_id]['label'] = $entity_type->getBundleLabel(); $this->derivatives[$entity_type_id]['context'] = [ $entity_type_id => new ContextDefinition('entity:' . $entity_type_id), ]; @@ -66,25 +65,4 @@ public function getDerivativeDefinitions($base_plugin_definition) { return $this->derivatives; } - /** - * Provides the bundle label with a fallback when not defined. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type we are looking the bundle label for. - * - * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup - * The entity bundle label or a fallback label. - */ - protected function getEntityBundleLabel(EntityTypeInterface $entity_type) { - if ($label = $entity_type->getBundleLabel()) { - return $label; - } - - if ($bundle_entity_type = $entity_type->getBundleEntityType()) { - return $this->entityTypeManager->getDefinition($bundle_entity_type)->getLabel(); - } - - return $this->t('@label bundle', ['@label' => $entity_type->getLabel()]); - } - } diff --git a/core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php b/core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php index a485f7eeee..0955bd9c65 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php +++ b/core/lib/Drupal/Core/Entity/Plugin/Condition/EntityBundle.php @@ -115,15 +115,7 @@ public function evaluate() { * {@inheritdoc} */ public function summary() { - if (!$bundle_type = $this->entityType->getBundleLabel()) { - if ($bundle_entity_type_id = $this->entityType->getBundleEntityType()) { - $bundle_type = $this->entityTypeManager->getDefinition($bundle_entity_type_id) - ->getLabel(); - } - else { - $bundle_type = $this->t('@label bundle', ['@label' => $this->entityType->getLabel()]); - } - } + $bundle_type = $this->entityType->getBundleLabel(); if (count($this->configuration['bundles']) > 1) { $bundles = $this->configuration['bundles']; $last = array_pop($bundles);