You are here

protected function ExtraFieldDisplayManager::supportedEntityBundles in Extra Field 8

Returns entity-bundle combinations this plugin supports.

If a wildcard bundle is set, all bundles of the entity will be included.

Parameters

string[] $entityBundleKeys: Array of entity-bundle strings that define the bundles for which the plugin can be used. Format: [entity].[bundle] '*' can be used as bundle wildcard.

Return value

array Array of entity and bundle names. Keyed by the [entity].[bundle] key.

1 call to ExtraFieldDisplayManager::supportedEntityBundles()
ExtraFieldDisplayManager::fieldInfo in src/Plugin/ExtraFieldDisplayManager.php
Exposes the ExtraFieldDisplay plugins to hook_entity_extra_field_info().

File

src/Plugin/ExtraFieldDisplayManager.php, line 154

Class

ExtraFieldDisplayManager
Manages Extra Field plugins.

Namespace

Drupal\extra_field\Plugin

Code

protected function supportedEntityBundles(array $entityBundleKeys) {
  $result = [];
  foreach ($entityBundleKeys as $entityBundleKey) {
    if (strpos($entityBundleKey, '.')) {
      list($entityType, $bundle) = explode('.', $entityBundleKey);
      if ($bundle == '*') {
        foreach ($this
          ->allEntityBundles($entityType) as $bundle) {
          $key = $this
            ->entityBundleKey($entityType, $bundle);
          $result[$key] = [
            'entity' => $entityType,
            'bundle' => $bundle,
          ];
        }
      }
      else {
        $result[$entityBundleKey] = [
          'entity' => $entityType,
          'bundle' => $bundle,
        ];
      }
    }
  }
  return $result;
}