Skip to content
Snippets Groups Projects
Verified Commit cc32980f 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
parent 6a685718
No related branches found
No related tags found
19 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #230506 canceled
......@@ -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.
Finish editing this message first!
Please register or to comment