Loading core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php +15 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ /** * Overrides the entity form controller service for layout builder operations. */ class LayoutBuilderHtmlEntityFormController { class LayoutBuilderHtmlEntityFormController extends FormController { use DependencySerializationTrait; Loading Loading @@ -56,4 +56,18 @@ public function getContentResult(Request $request, RouteMatchInterface $route_ma return $form; } /** * {@inheritdoc} */ protected function getFormArgument(RouteMatchInterface $route_match) { return $this->entityFormController->getFormArgument($route_match); } /** * {@inheritdoc} */ protected function getFormObject(RouteMatchInterface $route_match, $form_arg) { return $this->entityFormController->getFormObject($route_match, $form_arg); } } core/modules/layout_builder/tests/modules/layout_builder_decoration_test/layout_builder_decoration_test.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: 'Layout Builder Decoration test' type: module description: 'Support module for testing layout building.' package: Testing version: VERSION core/modules/layout_builder/tests/modules/layout_builder_decoration_test/layout_builder_decoration_test.services.yml 0 → 100644 +6 −0 Original line number Diff line number Diff line services: layout_builder_decoration_test.controller.entity_form: decorates: controller.entity_form class: Drupal\layout_builder_decoration_test\Controller\LayoutBuilderDecorationTestHtmlEntityFormController public: false arguments: ['@layout_builder_decoration_test.controller.entity_form.inner'] core/modules/layout_builder/tests/modules/layout_builder_decoration_test/src/Controller/LayoutBuilderDecorationTestHtmlEntityFormController.php 0 → 100644 +52 −0 Original line number Diff line number Diff line <?php namespace Drupal\layout_builder_decoration_test\Controller; use Drupal\Core\Controller\FormController; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\HttpFoundation\Request; /** * Overrides the entity form controller service for layout builder decoration test. */ class LayoutBuilderDecorationTestHtmlEntityFormController extends FormController { /** * The entity form controller being decorated. * * @var \Drupal\Core\Controller\FormController */ protected $entityFormController; /** * Constructs a LayoutBuilderDecorationTestHtmlEntityFormController object. * * @param \Drupal\Core\Controller\FormController $entity_form_controller * The entity form controller being decorated. */ public function __construct(FormController $entity_form_controller) { $this->entityFormController = $entity_form_controller; } /** * {@inheritdoc} */ public function getContentResult(Request $request, RouteMatchInterface $route_match) { return $this->entityFormController->getContentResult($request, $route_match); } /** * {@inheritdoc} */ protected function getFormArgument(RouteMatchInterface $route_match) { return $this->entityFormController->getFormArgument($route_match); } /** * {@inheritdoc} */ protected function getFormObject(RouteMatchInterface $route_match, $form_arg) { return $this->entityFormController->getFormObject($route_match, $form_arg); } } core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php +17 −0 Original line number Diff line number Diff line Loading @@ -447,6 +447,23 @@ public function testLayoutBuilderUi() { $this->assertSame($expected_labels, $labels); } /** * Test decorating controller.entity_form while layout_builder is installed. */ public function testHtmlEntityFormControllerDecoration() { $assert_session = $this->assertSession(); $this->drupalLogin($this->drupalCreateUser([ 'configure any layout', 'administer node display', ])); // Install module that decorates controller.entity_form. \Drupal::service('module_installer')->install(['layout_builder_decoration_test']); $this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default'); $assert_session->pageTextContains('Manage Display'); } /** * Test that layout builder checks entity view access. */ Loading Loading
core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php +15 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ /** * Overrides the entity form controller service for layout builder operations. */ class LayoutBuilderHtmlEntityFormController { class LayoutBuilderHtmlEntityFormController extends FormController { use DependencySerializationTrait; Loading Loading @@ -56,4 +56,18 @@ public function getContentResult(Request $request, RouteMatchInterface $route_ma return $form; } /** * {@inheritdoc} */ protected function getFormArgument(RouteMatchInterface $route_match) { return $this->entityFormController->getFormArgument($route_match); } /** * {@inheritdoc} */ protected function getFormObject(RouteMatchInterface $route_match, $form_arg) { return $this->entityFormController->getFormObject($route_match, $form_arg); } }
core/modules/layout_builder/tests/modules/layout_builder_decoration_test/layout_builder_decoration_test.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: 'Layout Builder Decoration test' type: module description: 'Support module for testing layout building.' package: Testing version: VERSION
core/modules/layout_builder/tests/modules/layout_builder_decoration_test/layout_builder_decoration_test.services.yml 0 → 100644 +6 −0 Original line number Diff line number Diff line services: layout_builder_decoration_test.controller.entity_form: decorates: controller.entity_form class: Drupal\layout_builder_decoration_test\Controller\LayoutBuilderDecorationTestHtmlEntityFormController public: false arguments: ['@layout_builder_decoration_test.controller.entity_form.inner']
core/modules/layout_builder/tests/modules/layout_builder_decoration_test/src/Controller/LayoutBuilderDecorationTestHtmlEntityFormController.php 0 → 100644 +52 −0 Original line number Diff line number Diff line <?php namespace Drupal\layout_builder_decoration_test\Controller; use Drupal\Core\Controller\FormController; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\HttpFoundation\Request; /** * Overrides the entity form controller service for layout builder decoration test. */ class LayoutBuilderDecorationTestHtmlEntityFormController extends FormController { /** * The entity form controller being decorated. * * @var \Drupal\Core\Controller\FormController */ protected $entityFormController; /** * Constructs a LayoutBuilderDecorationTestHtmlEntityFormController object. * * @param \Drupal\Core\Controller\FormController $entity_form_controller * The entity form controller being decorated. */ public function __construct(FormController $entity_form_controller) { $this->entityFormController = $entity_form_controller; } /** * {@inheritdoc} */ public function getContentResult(Request $request, RouteMatchInterface $route_match) { return $this->entityFormController->getContentResult($request, $route_match); } /** * {@inheritdoc} */ protected function getFormArgument(RouteMatchInterface $route_match) { return $this->entityFormController->getFormArgument($route_match); } /** * {@inheritdoc} */ protected function getFormObject(RouteMatchInterface $route_match, $form_arg) { return $this->entityFormController->getFormObject($route_match, $form_arg); } }
core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php +17 −0 Original line number Diff line number Diff line Loading @@ -447,6 +447,23 @@ public function testLayoutBuilderUi() { $this->assertSame($expected_labels, $labels); } /** * Test decorating controller.entity_form while layout_builder is installed. */ public function testHtmlEntityFormControllerDecoration() { $assert_session = $this->assertSession(); $this->drupalLogin($this->drupalCreateUser([ 'configure any layout', 'administer node display', ])); // Install module that decorates controller.entity_form. \Drupal::service('module_installer')->install(['layout_builder_decoration_test']); $this->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default'); $assert_session->pageTextContains('Manage Display'); } /** * Test that layout builder checks entity view access. */ Loading