/** * Returns the allowed Entity Embed Display plugins given an embed button and * an entity. * * @param \Drupal\embed\EmbedButtonInterface $embed_button * The embed button. * @param \Drupal\Core\Entity\EntityInterface $entity * The entity. * * @return array * List of allowed Entity Embed Display plugins. */ public function getDisplayPluginOptions(EmbedButtonInterface $embed_button, EntityInterface $entity) { $plugins = $this->displayPluginManager->getDefinitionOptionsForEntity($entity); if ($allowed_plugins = $embed_button->getTypeSetting('display_plugins')) { $plugins = array_intersect_key($plugins, array_flip($allowed_plugins)); } natsort($plugins); return $plugins; }