You are here

public function MediaScheduler::getTypes in Scheduler 2.x

Get the available types/bundles for the entity type.

Do not use static or drupal_static here, because changes to third-party settings invalidate the saved values during phpunit testing.

Return value

array The media bundle objects, keyed by bundle name, or an empty array if Media is not enabled.

Overrides SchedulerPluginBase::getTypes

1 call to MediaScheduler::getTypes()
MediaScheduler::entityFormIds in src/Plugin/Scheduler/MediaScheduler.php
Get the form IDs for media add/edit forms.

File

src/Plugin/Scheduler/MediaScheduler.php, line 36

Class

MediaScheduler
Plugin for Media entity type.

Namespace

Drupal\scheduler\Plugin\Scheduler

Code

public function getTypes() {
  if (!\Drupal::moduleHandler()
    ->moduleExists('media')) {
    return [];
  }
  $mediaTypes = \Drupal::entityTypeManager()
    ->getStorage('media_type')
    ->loadMultiple();
  return $mediaTypes;
}