Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
plugin
Drupal Environment
Commits
3dea3843
Commit
3dea3843
authored
1 year ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Update core patch"
This reverts commit
53404442
.
parent
e8eb6b8f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!155
Merging develop into main
Pipeline
#1193365
passed with warnings
1 year ago
Stage: build
Stage: validate
Stage: release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
patches/d10/3043879.diff
+181
-19
181 additions, 19 deletions
patches/d10/3043879.diff
with
181 additions
and
19 deletions
patches/d10/3043879.diff
+
181
−
19
View file @
3dea3843
diff --git a/core/lib/Drupal/Core/Layout/LayoutDefault.php b/core/lib/Drupal/Core/Layout/LayoutDefault.php
index
bd3780987a..8fc99d76ea
100644
index
607b34a48cd91bf740f3e6eda563a8de8b659467..bb97f8b42ffd61d185ed25eab2d91b12dc91c3d5
100644
--- a/core/lib/Drupal/Core/Layout/LayoutDefault.php
+++ b/core/lib/Drupal/Core/Layout/LayoutDefault.php
@@ -8,6 +8,7 @@
...
...
@@ -18,7 +18,7 @@ index bd3780987a..8fc99d76ea 100644
/**
* Whether the plugin is being rendered in preview mode.
@@ -12
7
,6 +12
9
,13 @@
public function submitConfigurationForm(array &$form, FormStateInterface $form_s
@@ -12
6
,6 +12
8
,13 @@
public function submitConfigurationForm(array &$form, FormStateInterface $form_s
$this->configuration['label'] = $form_state->getValue('label');
}
...
...
@@ -33,7 +33,7 @@ index bd3780987a..8fc99d76ea 100644
* {@inheritdoc}
*/
diff --git a/core/lib/Drupal/Core/Layout/LayoutInterface.php b/core/lib/Drupal/Core/Layout/LayoutInterface.php
index 33858a546d
..2e62ba85d
a 100644
index 33858a546d
7fc0f2696c408873f4b9bf51cb9b7c..2e62ba85da65ed7029abd5df9571348e9bfcd7f
a 100644
--- a/core/lib/Drupal/Core/Layout/LayoutInterface.php
+++ b/core/lib/Drupal/Core/Layout/LayoutInterface.php
@@ -7,11 +7,12 @@
...
...
@@ -51,7 +51,7 @@ index 33858a546d..2e62ba85da 100644
/**
* Build a render array for layout with regions.
diff --git a/core/modules/layout_builder/src/Controller/ChooseSectionController.php b/core/modules/layout_builder/src/Controller/ChooseSectionController.php
index 46b969e2f8
..bc22d1f004
100644
index 46b969e2f8
ba15a75da1be3b0f9a3bb71f30e138..bc22d1f004b7a828155a811758026e7d631a1ed9
100644
--- a/core/modules/layout_builder/src/Controller/ChooseSectionController.php
+++ b/core/modules/layout_builder/src/Controller/ChooseSectionController.php
@@ -4,8 +4,10 @@
...
...
@@ -99,7 +99,7 @@ index 46b969e2f8..bc22d1f004 100644
'section_storage_type' => $section_storage->getStorageType(),
'section_storage' => $section_storage->getStorageId(),
diff --git a/core/modules/layout_builder/src/Element/LayoutBuilder.php b/core/modules/layout_builder/src/Element/LayoutBuilder.php
index
451927e540..8234a476ab
100644
index
5c91b1e39208a7895c6cb664c1f5e793c8d9522c..e8c83d975fd37c8c80af9f97b0fd47c942f1f615
100644
--- a/core/modules/layout_builder/src/Element/LayoutBuilder.php
+++ b/core/modules/layout_builder/src/Element/LayoutBuilder.php
@@ -3,8 +3,10 @@
...
...
@@ -110,10 +110,10 @@ index 451927e540..8234a476ab 100644
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginFormInterface;
+use Drupal\Core\Plugin\PluginWithFormsInterface;
use Drupal\Core\Render\Attribute\RenderElement;
use Drupal\Core\Render\Element;
use Drupal\Core\Render\Element\RenderElement as RenderElementBase;
@@ -325,6 +327,7 @@
protected function buildAdministrativeSection(SectionStorageInterface $section_s
use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Url;
@@ -337,6 +339,7 @@
protected function buildAdministrativeSection(SectionStorageInterface $section_s
$build['#attributes']['class'][] = 'layout-builder__layout';
$build['#attributes']['data-layout-builder-highlight-id'] = $this->sectionUpdateHighlightId($delta);
...
...
@@ -121,7 +121,7 @@ index 451927e540..8234a476ab 100644
return [
'#type' => 'container',
'#attributes' => [
@@ -3
54
,12 +3
57
,12 @@
protected function buildAdministrativeSection(SectionStorageInterface $section_s
@@ -3
66
,12 +3
69
,12 @@
protected function buildAdministrativeSection(SectionStorageInterface $section_s
// link, and is only visible when the move block dialog is open.
'section_label' => [
'#markup' => $this->t('<span class="layout-builder__section-label" aria-hidden="true">@section</span>', ['@section' => $section_label]),
...
...
@@ -136,7 +136,7 @@ index 451927e540..8234a476ab 100644
'#url' => Url::fromRoute('layout_builder.configure_section', [
'section_storage_type' => $storage_type,
'section_storage' => $storage_id,
@@ -3
7
9,4 +3
82
,21 @@
protected function buildAdministrativeSection(SectionStorageInterface $section_s
@@ -39
1
,4 +3
94
,21 @@
protected function buildAdministrativeSection(SectionStorageInterface $section_s
];
}
...
...
@@ -159,7 +159,7 @@ index 451927e540..8234a476ab 100644
+
}
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module b/core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module
index
fa027a6b01..443bbcfdfa
100644
index
cd6070f53ff33d4f20ef609513ff335c57b63c60..8b6b00419be68eb7d48072f6e0d223f25f9c400c
100644
--- a/core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/layout_builder_test.module
@@ -13,6 +13,7 @@
...
...
@@ -170,10 +170,11 @@ index fa027a6b01..443bbcfdfa 100644
/**
* Implements hook_plugin_filter_TYPE__CONSUMER_alter().
@@ -177,6 +178,27 @@
function layout_builder_test_module_implements_alter(&$implementations, $hook) {
@@ -131,3 +132,24 @@
function layout_builder_test_module_implements_alter(&$implementations, $hook) {
] + $implementations;
}
}
+
+/**
+ * Implements hook_layout_alter().
+ */
...
...
@@ -194,16 +195,177 @@ index fa027a6b01..443bbcfdfa 100644
+ $variables['content']['main']['custom_element']['#markup'] = $variables['settings']['custom_element'];
+ }
+}
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestCustomFormPlugin.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestCustomFormPlugin.php
new file mode 100644
index 0000000000000000000000000000000000000000..059a3eb4d8847695d1cbc02fee806c72b9cf94d6
--- /dev/null
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestCustomFormPlugin.php
@@ -0,0 +1,23 @@
+<?php
+
/**
* Implements hook_theme().
*/
+namespace Drupal\layout_builder_test\Plugin\Layout;
+
+use Drupal\Core\Layout\LayoutDefault;
+
+/**
+ * @Layout(
+ * id = "layout_builder_test_custom_form_plugin",
+ * label = @Translation("Layout Builder Test Custom Form Plugin"),
+ * regions = {
+ * "main" = {
+ * "label" = @Translation("Main Region")
+ * }
+ * },
+ * forms = {
+ * "configure" = "Drupal\layout_builder_test\PluginForm\CustomLayoutForm",
+ * },
+ * )
+ */
+class LayoutBuilderTestCustomFormPlugin extends LayoutDefault {
+
+}
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestNoFormPlugin.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestNoFormPlugin.php
new file mode 100644
index 0000000000000000000000000000000000000000..4cef17f51f56591ab331a465274c6fc8e241adc3
--- /dev/null
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/LayoutBuilderTestNoFormPlugin.php
@@ -0,0 +1,75 @@
+<?php
+
+namespace Drupal\layout_builder_test\Plugin\Layout;
+
+use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Layout\LayoutInterface;
+use Drupal\Core\Plugin\PluginBase;
+use Drupal\Core\Plugin\PluginWithFormsTrait;
+
+/**
+ * Provides a plugin that does not extend \Drupal\Core\Layout\LayoutDefault.
+ *
+ * @Layout(
+ * id = "layout_builder_test_no_form_plugin",
+ * label = @Translation("Layout Builder Test No Form Plugin"),
+ * regions = {
+ * "main" = {
+ * "label" = @Translation("Main Region")
+ * }
+ * },
+ * )
+ */
+class LayoutBuilderTestNoFormPlugin extends PluginBase implements LayoutInterface {
+
+ use PluginWithFormsTrait;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function build(array $regions) {
+ $build = $regions;
+ $build['#settings'] = $this->getConfiguration();
+ $build['#layout'] = $this->pluginDefinition;
+ $build['#theme'] = $this->pluginDefinition->getThemeHook();
+ return $build;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getConfiguration() {
+ return $this->configuration;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setConfiguration(array $configuration) {
+ $this->configuration = NestedArray::mergeDeep($this->defaultConfiguration(), $configuration);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function defaultConfiguration() {
+ return [
+ 'label' => '',
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function calculateDependencies() {
+ return [];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFormClass($operation) {
+ return $this->getPluginDefinition()->get('forms')[$operation] ?? NULL;
+ }
+
+}
diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/PluginForm/CustomLayoutForm.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/PluginForm/CustomLayoutForm.php
new file mode 100644
index 0000000000000000000000000000000000000000..8499f8bde1faa443b4d8220f50599d92c43291c2
--- /dev/null
+++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/PluginForm/CustomLayoutForm.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Drupal\layout_builder_test\PluginForm;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Plugin\PluginFormBase;
+use Drupal\Core\Plugin\PluginFormInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+
+/**
+ * Provides a custom form for a layout plugin.
+ */
+class CustomLayoutForm extends PluginFormBase {
+
+ use StringTranslationTrait;
+
+ /**
+ * The plugin.
+ *
+ * @var \Drupal\Core\Layout\LayoutInterface
+ */
+ protected $plugin;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+ $form = $this->plugin instanceof PluginFormInterface ? $this->plugin->buildConfigurationForm($form, $form_state) : [];
+ $form['custom_element'] = [
+ '#title' => $this->t('Custom element'),
+ '#type' => 'textfield',
+ '#default_value' => $this->plugin->getConfiguration()['custom_element'] ?? '',
+ ];
+ return $form;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
+ if ($this->plugin instanceof PluginFormInterface) {
+ $this->plugin->submitConfigurationForm($form, $form_state);
+ }
+ $configuration = $this->plugin->getConfiguration();
+ $configuration['custom_element'] = $form_state->getValue('custom_element');
+ $this->plugin->setConfiguration($configuration);
+ }
+
+}
diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php
index
631159a8b3..24f0ff05e7
100644
index
f135ac4cb17ca6155dde107c2a04205677e82a5d..ec692e9b45cd777fdc324a366aaf7a89f6614a68
100644
--- a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php
+++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php
@@ -
458
,6 +
458
,46 @@
public function test
PreviewAwareTempla
te
s
() {
$assert_session->
pageTextNotContains('This is a preview, inde
ed');
@@ -
963
,6 +
963
,46 @@
public function test
LayoutBuilderChooseBlocksAl
te
r
() {
$assert_session->
linkExists('Chang
ed');
}
+ /**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment