You are here

public function MediaDevelGenerate::__construct in Devel 4.x

Same name and namespace in other branches
  1. 8.3 devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\MediaDevelGenerate::__construct()

Constructs a new 'media' plugin instance.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

array $plugin_definition: The plugin definition.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager service.

\Drupal\Core\Routing\UrlGeneratorInterface $url_generator: The url generator service.

\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter service.

\Drupal\Component\Datetime\TimeInterface $time: The time service.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown if the storage handler couldn't be loaded.

\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown if the entity type doesn't exist.

Overrides PluginBase::__construct

File

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

Class

MediaDevelGenerate
Provides a plugin that generates media entities.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public function __construct(array $configuration, $plugin_id, array $plugin_definition, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, UrlGeneratorInterface $url_generator, DateFormatterInterface $date_formatter, TimeInterface $time) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->mediaStorage = $entity_type_manager
    ->getStorage('media');
  $this->mediaTypeStorage = $entity_type_manager
    ->getStorage('media_type');
  $this->userStorage = $entity_type_manager
    ->getStorage('user');
  $this->languageManager = $language_manager;
  $this->urlGenerator = $url_generator;
  $this->dateFormatter = $date_formatter;
  $this->time = $time;
}