function ContentDevelGenerate::create
Same name in other branches
- 4.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::create()
Overrides DevelGenerateBase::create
File
-
devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php, line 120
Class
- ContentDevelGenerate
- Provides a ContentDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : static {
$entity_type_manager = $container->get('entity_type.manager');
// @phpstan-ignore ternary.alwaysTrue (False positive)
$comment_manager = $container->has('comment.manager') ? $container->get('comment.manager') : NULL;
// @phpstan-ignore ternary.alwaysTrue (False positive)
$content_translation_manager = $container->has('content_translation.manager') ? $container->get('content_translation.manager') : NULL;
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
$instance->nodeTypeStorage = $entity_type_manager->getStorage('node_type');
$instance->nodeStorage = $entity_type_manager->getStorage('node');
$instance->userStorage = $entity_type_manager->getStorage('user');
$instance->urlGenerator = $container->get('url_generator');
$instance->aliasStorage = $entity_type_manager->getStorage('path_alias');
$instance->dateFormatter = $container->get('date.formatter');
$instance->time = $container->get('datetime.time');
$instance->database = $container->get('database');
$instance->extensionPathResolver = $container->get('extension.path.resolver');
$instance->roleStorage = $entity_type_manager->getStorage('user_role');
$instance->commentManager = $comment_manager;
$instance->contentTranslationManager = $content_translation_manager;
return $instance;
}