You are here

protected function FieldBlockConfigForm::getEntityTypeLabels in Field as Block 8.2

Get Entity Type labels for all compatible Entity Types.

Return value

array Array of entity type labels keyed by the entity type machine name.

1 call to FieldBlockConfigForm::getEntityTypeLabels()
FieldBlockConfigForm::buildForm in src/Form/FieldBlockConfigForm.php
Form constructor.

File

src/Form/FieldBlockConfigForm.php, line 208

Class

FieldBlockConfigForm
Configuration for select Entity types and delete blocks of unused types.

Namespace

Drupal\fieldblock\Form

Code

protected function getEntityTypeLabels() {
  $definitions = $this->entityTypeManager
    ->getDefinitions();
  $labels = [];

  /** @var \Drupal\Core\Entity\EntityTypeInterface $definition */
  foreach ($definitions as $definition) {
    if ($this->fieldblockController
      ->isFieldBlockCompatible($definition)) {
      $labels[$definition
        ->id()] = $definition
        ->getLabel();
    }
  }
  return $labels;
}