You are here

protected function ExtraFieldManagerBase::supportedEntityBundles in Extra Field 8.2

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.

2 calls to ExtraFieldManagerBase::supportedEntityBundles()
ExtraFieldDisplayManager::fieldInfo in src/Plugin/ExtraFieldDisplayManager.php
Exposes the ExtraField plugins to hook_entity_extra_field_info().
ExtraFieldFormManager::fieldInfo in src/Plugin/ExtraFieldFormManager.php
Exposes the ExtraField plugins to hook_entity_extra_field_info().

File

src/Plugin/ExtraFieldManagerBase.php, line 81

Class

ExtraFieldManagerBase
Base class for Extra Field plugin managers.

Namespace

Drupal\extra_field\Plugin

Code

protected function supportedEntityBundles(array $entityBundleKeys) {
  $result = [];
  foreach ($entityBundleKeys as $entityBundleKey) {
    if (strpos($entityBundleKey, '.') === FALSE) {
      continue;
    }
    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;
}