Skip to content
Snippets Groups Projects
Commit a6c28900 authored by mschudders's avatar mschudders
Browse files

PAss correct number of args to section_libr.

parent 194272a9
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,15 @@
namespace Drupal\layoutbuilder_extras\Controller;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\File\FileUrlGeneratorInterface;
use Drupal\Core\Layout\LayoutPluginManagerInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\layout_builder\Controller\ChooseSectionController;
use Drupal\layout_builder\SectionStorageInterface;
......@@ -43,6 +48,34 @@ class LayoutBuilderExtrasSectionActionsController implements ContainerInjectionI
*/
protected $module_handler;
/**
* The renderer service.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected RendererInterface $renderer;
/**
* The file url generator service.
*
* @var \Drupal\Core\File\FileUrlGeneratorInterface
*/
protected FileUrlGeneratorInterface $fileUrlGenerator;
/**
* The section library config.
*
* @var \Drupal\Core\Config\ConfigManagerInterface
*/
protected ConfigManagerInterface $config;
/**
* The Drupal Logger Factory.
*
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
*/
protected $loggerFactory;
/**
* ChooseSectionController constructor.
*
......@@ -53,10 +86,14 @@ class LayoutBuilderExtrasSectionActionsController implements ContainerInjectionI
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* Module handler.
*/
public function __construct(LayoutPluginManagerInterface $layout_manager, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler) {
public function __construct(LayoutPluginManagerInterface $layout_manager, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, FileUrlGeneratorInterface $file_url_generator, ConfigManagerInterface $config_manager, LoggerChannelFactoryInterface $loggerFactory) {
$this->layoutManager = $layout_manager;
$this->entityTypeManager = $entity_type_manager;
$this->module_handler = $module_handler;
$this->renderer = $renderer;
$this->fileUrlGenerator = $file_url_generator;
$this->config = $config_manager;
$this->loggerFactory = $loggerFactory;
}
/**
......@@ -66,7 +103,11 @@ class LayoutBuilderExtrasSectionActionsController implements ContainerInjectionI
return new static(
$container->get('plugin.manager.core.layout'),
$container->get('entity_type.manager'),
$container->get('module_handler')
$container->get('module_handler'),
$container->get('renderer'),
$container->get('file_url_generator'),
$container->get('config.manager'),
$container->get('logger.factory')
);
}
......@@ -83,7 +124,14 @@ class LayoutBuilderExtrasSectionActionsController implements ContainerInjectionI
*/
public function build(SectionStorageInterface $section_storage, int $delta) {
if ($this->module_handler->moduleExists('section_library')) {
$chooseSectionFromLibController = new ChooseSectionFromLibraryController($this->entityTypeManager, $this->module_handler);
$chooseSectionFromLibController = new ChooseSectionFromLibraryController(
$this->entityTypeManager,
$this->module_handler,
$this->renderer,
$this->fileUrlGenerator,
$this->config,
$this->loggerFactory
);
$output['from_library'] = [
'#type' => 'details',
'#title' => $this->t('From library'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment