You are here

public function EntityEmbedDisplayManager::getDefinitionOptionsForEntity in Entity Embed 8

Gets definition options for entity.

Provides a list of plugins that can be used for a certain entity and filters out plugins that should be hidden in the UI.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity object.

Return value

array An array of valid plugin labels, keyed by plugin ID.

File

src/EntityEmbedDisplay/EntityEmbedDisplayManager.php, line 129

Class

EntityEmbedDisplayManager
Provides an Entity Embed display plugin manager.

Namespace

Drupal\entity_embed\EntityEmbedDisplay

Code

public function getDefinitionOptionsForEntity(EntityInterface $entity) {
  $definitions = $this
    ->getDefinitionsForContexts([
    'entity' => $entity,
    'entity_type' => $entity
      ->getEntityTypeId(),
  ]);
  $definitions = $this
    ->filterExposedDefinitions($definitions);
  return array_map(function ($definition) {
    return (string) $definition['label'];
  }, $definitions);
}