You are here

protected function SettingsForm::getBundleTypeLabel in Like & Dislike 8

Returns the bundle type label for a given entity type.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

string The bundle type label.

1 call to SettingsForm::getBundleTypeLabel()
SettingsForm::buildForm in src/Form/SettingsForm.php
Defines the settings form for each entity type bundles.

File

src/Form/SettingsForm.php, line 221

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\like_and_dislike\Form

Code

protected function getBundleTypeLabel(EntityTypeInterface $entity_type) {
  if ($bundle_type_label = $entity_type
    ->getBundleLabel()) {
    return $bundle_type_label;
  }
  if ($bundle_entity_type = $entity_type
    ->getBundleEntityType()) {
    return $this->entityTypeManager
      ->getDefinition($bundle_entity_type)
      ->getLabel();
  }
  return $this
    ->t('@label type', [
    '@label' => $entity_type
      ->getLabel(),
  ]);
}