EntityFieldDeriver.php in Context entity field 8
File
src/Plugin/Deriver/EntityFieldDeriver.php
View source
<?php
namespace Drupal\context_entity_field\Plugin\Deriver;
use Drupal\ctools\Plugin\Deriver\EntityBundle;
class EntityFieldDeriver extends EntityBundle {
protected function getEntityBundleLabel($entity_type) {
if ($label = $entity_type
->getBundleLabel()) {
return $this
->t('@label field', [
'@label' => $label,
]);
}
$fallback = $entity_type
->getLabel();
if ($bundle_entity_type = $entity_type
->getBundleEntityType()) {
$fallback = $this->entityTypeManager
->getDefinition($bundle_entity_type)
->getLabel();
}
return $this
->t('@label bundle field', [
'@label' => $fallback,
]);
}
}