function MediaDevelGenerate::create

Same name in other branches
  1. 4.x devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\MediaDevelGenerate::create()

Overrides DevelGenerateBase::create

File

devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php, line 83

Class

MediaDevelGenerate
Provides a plugin that generates media entities.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : static {
    $entity_type_manager = $container->get('entity_type.manager');
    $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
    $instance->mediaStorage = $entity_type_manager->getStorage('media');
    $instance->mediaTypeStorage = $entity_type_manager->getStorage('media_type');
    $instance->userStorage = $entity_type_manager->getStorage('user');
    $instance->urlGenerator = $container->get('url_generator');
    $instance->dateFormatter = $container->get('date.formatter');
    $instance->time = $container->get('datetime.time');
    $instance->extensionPathResolver = $container->get('extension.path.resolver');
    return $instance;
}