You are here

function _media_entity_get_bundles_by_plugin in Media entity 8.2

Gets the names of all media bundles that use a particular type plugin.

Parameters

string $plugin_id: The type plugin ID.

Return value

string[] The media bundle IDs which use the specified plugin.

2 calls to _media_entity_get_bundles_by_plugin()
CliService::validateDbUpdateRequirements in src/CliService.php
Verify if the upgrade to Media in core is possible.
_media_entity_get_bundles_using_exif in ./media_entity.install
Checks whether this site has image types with EXIF handling enabled.

File

./media_entity.install, line 124
Install, uninstall and update hooks for Media entity module.

Code

function _media_entity_get_bundles_by_plugin($plugin_id) {
  $types = [];
  foreach (\Drupal::configFactory()
    ->listAll('media_entity.bundle') as $name) {
    if (\Drupal::config($name)
      ->get('type') == $plugin_id) {
      $types[] = explode('.', $name, 3)[2];
    }
  }
  return $types;
}