You are here

public function EntityHandlerPluginManager::getHandlerOptions in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Type/EntityHandlerPluginManager.php \Drupal\cms_content_sync\Plugin\Type\EntityHandlerPluginManager::getHandlerOptions()
  2. 2.1.x src/Plugin/Type/EntityHandlerPluginManager.php \Drupal\cms_content_sync\Plugin\Type\EntityHandlerPluginManager::getHandlerOptions()

Parameters

string $entity_type: The entity type of the processed entity

string $bundle: The bundle of the processed entity

bool $labels_only: Whether to return labels instead of the whole definition

Return value

array An associative array $id=>$label|$handlerDefinition to display options

File

src/Plugin/Type/EntityHandlerPluginManager.php, line 245

Class

EntityHandlerPluginManager
Manages discovery and instantiation of entity handler plugins.

Namespace

Drupal\cms_content_sync\Plugin\Type

Code

public function getHandlerOptions($entity_type, $bundle, $labels_only = false) {
  $options = [];
  foreach ($this
    ->getDefinitions() as $id => $definition) {
    if (!$definition['class']::supports($entity_type, $bundle)) {
      continue;
    }
    $options[$id] = $labels_only ? $definition['label']
      ->render() : $definition;
  }
  return $options;
}