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

Issue #3126746 by danflanagan8, Deepak Goyal, Neslee Canil Pinto, geek-merlin,...

Issue #3126746 by danflanagan8, Deepak Goyal, Neslee Canil Pinto, geek-merlin, tim.plunkett: LayoutBuilderHtmlEntityFormController breaks decoration

(cherry picked from commit 6ffbfe25)
parent 69345ad8
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@
/**
* Overrides the entity form controller service for layout builder operations.
*/
class LayoutBuilderHtmlEntityFormController {
class LayoutBuilderHtmlEntityFormController extends FormController {
use DependencySerializationTrait;
......@@ -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);
}
}
name: 'Layout Builder Decoration test'
type: module
description: 'Support module for testing layout building.'
package: Testing
version: VERSION
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']
<?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);
}
}
......@@ -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.
*/
......
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