Skip to content
Snippets Groups Projects
Verified Commit c082ee7e authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3392572 by benjifisher, Liam Morland, ricovandevin, Anybody,...

Issue #3392572 by benjifisher, Liam Morland, ricovandevin, Anybody, smustgrave, quietone, sabrina.liman, carolpettirossi, longwave, alexpott: Add missing category to Drupal\layout_builder\Plugin\Layout\BlankLayout and let modules and themes alter the list of layouts

(cherry picked from commit cc32980f)
parent c3c8f13a
Branches
Tags
11 merge requests!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8949Backport .gitlabci.yml changes.,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #230489 passed with warnings
Pipeline: drupal

#230510

    Pipeline: drupal

    #230502

      Pipeline: drupal

      #230494

        ......@@ -227,7 +227,8 @@ public function getGroupedDefinitions(?array $definitions = NULL, $label_key = '
        */
        public function getLayoutOptions() {
        $layout_options = [];
        foreach ($this->getGroupedDefinitions() as $category => $layout_definitions) {
        $filtered_definitions = $this->getFilteredDefinitions($this->getType());
        foreach ($this->getGroupedDefinitions($filtered_definitions) as $category => $layout_definitions) {
        foreach ($layout_definitions as $name => $layout_definition) {
        $layout_options[$category][$name] = $layout_definition->getLabel();
        }
        ......
        ......@@ -18,7 +18,8 @@
        */
        #[Layout(
        id: 'layout_builder_blank',
        label: new TranslatableMarkup('Blank'),
        label: new TranslatableMarkup('Blank Layout'),
        category: new TranslatableMarkup('Blank Layout'),
        )]
        class BlankLayout extends LayoutDefault {
        ......
        ......@@ -17,6 +17,7 @@
        use Drupal\Core\Layout\LayoutInterface;
        use Drupal\Core\Layout\LayoutPluginManager;
        use Drupal\Core\StringTranslation\TranslatableMarkup;
        use Drupal\Core\Theme\ThemeManagerInterface;
        use Drupal\Tests\UnitTestCase;
        use org\bovigo\vfs\vfsStream;
        use Prophecy\Argument;
        ......@@ -43,6 +44,13 @@ class LayoutPluginManagerTest extends UnitTestCase {
        */
        protected $themeHandler;
        /**
        * The theme manager.
        *
        * @var \Drupal\Core\Theme\ThemeManagerInterface
        */
        protected $themeManager;
        /**
        * Cache backend instance.
        *
        ......@@ -67,6 +75,8 @@ protected function setUp(): void {
        $container = new ContainerBuilder();
        $container->set('string_translation', $this->getStringTranslationStub());
        $this->themeManager = $this->prophesize(ThemeManagerInterface::class);
        $container->set('theme.manager', $this->themeManager->reveal());
        \Drupal::setContainer($container);
        $this->moduleHandler = $this->prophesize(ModuleHandlerInterface::class);
        ......@@ -347,6 +357,28 @@ public function testGetGroupedDefinitions(): void {
        }
        }
        /**
        * @covers ::getLayoutOptions
        *
        * Test that modules and themes can alter the list of layouts.
        */
        public function testGetLayoutOptions(): void {
        $this->moduleHandler->alter(
        ['plugin_filter_layout', 'plugin_filter_layout__layout'],
        Argument::type('array'),
        [],
        'layout',
        )->shouldBeCalled();
        $this->themeManager->alter(
        ['plugin_filter_layout', 'plugin_filter_layout__layout'],
        Argument::type('array'),
        [],
        'layout',
        )->shouldBeCalled();
        $this->layoutPluginManager->getLayoutOptions();
        }
        /**
        * Sets up the filesystem with YAML files and annotated plugins.
        */
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment