LayoutBuilderHtmlEntityFormController.php in Drupal 9
File
core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php
View source
<?php
namespace Drupal\layout_builder\Controller;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Controller\FormController;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\HttpFoundation\Request;
class LayoutBuilderHtmlEntityFormController extends FormController {
use DependencySerializationTrait;
protected $entityFormController;
public function __construct(FormController $entity_form_controller) {
$this->entityFormController = $entity_form_controller;
}
public function getContentResult(Request $request, RouteMatchInterface $route_match) {
$form = $this->entityFormController
->getContentResult($request, $route_match);
if (isset($form['#layout_builder_element_keys'])) {
$build['form'] =& $form;
$layout_builder_element =& NestedArray::getValue($form, $form['#layout_builder_element_keys']);
$build['layout_builder'] = $layout_builder_element;
$layout_builder_element = [];
return $build;
}
return $form;
}
protected function getFormArgument(RouteMatchInterface $route_match) {
return $this->entityFormController
->getFormArgument($route_match);
}
protected function getFormObject(RouteMatchInterface $route_match, $form_arg) {
return $this->entityFormController
->getFormObject($route_match, $form_arg);
}
}