class LayoutBuilderHtmlEntityFormController
Overrides the entity form controller service for layout builder operations.
Hierarchy
- class \Drupal\Core\Controller\FormController uses \Drupal\Core\DependencyInjection\DependencySerializationTrait- class \Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController uses \Drupal\Core\DependencyInjection\DependencySerializationTrait extends \Drupal\Core\Controller\FormController
 
Expanded class hierarchy of LayoutBuilderHtmlEntityFormController
1 string reference to 'LayoutBuilderHtmlEntityFormController'
- layout_builder.services.yml in core/modules/ layout_builder/ layout_builder.services.yml 
- core/modules/layout_builder/layout_builder.services.yml
1 service uses LayoutBuilderHtmlEntityFormController
File
- 
              core/modules/ layout_builder/ src/ Controller/ LayoutBuilderHtmlEntityFormController.php, line 14 
Namespace
Drupal\layout_builder\ControllerView source
class LayoutBuilderHtmlEntityFormController extends FormController {
  use DependencySerializationTrait;
  
  /**
   * The entity form controller being decorated.
   *
   * @var \Drupal\Core\Controller\FormController
   */
  protected $entityFormController;
  
  /**
   * Constructs a LayoutBuilderHtmlEntityFormController 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) {
    $form = $this->entityFormController
      ->getContentResult($request, $route_match);
    // If the form render element has a #layout_builder_element_keys property,
    // first set the form element as a child of the root render array. Use the
    // keys to get the layout builder element from the form render array and
    // copy it to a separate child element of the root element to prevent any
    // forms within the layout builder element from being nested.
    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;
      // Remove the layout builder element within the form.
      $layout_builder_element = [];
      return $build;
    }
    // If no #layout_builder_element_keys property, return form as is.
    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);
  }
}Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides | 
|---|---|---|---|---|---|
| DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | ||
| DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | ||
| DependencySerializationTrait::__sleep | public | function | 2 | ||
| DependencySerializationTrait::__wakeup | public | function | #[\ReturnTypeWillChange] | 2 | |
| FormController::$argumentResolver | protected | property | The argument resolver. | ||
| FormController::$formBuilder | protected | property | The form builder. | ||
| LayoutBuilderHtmlEntityFormController::$entityFormController | protected | property | The entity form controller being decorated. | ||
| LayoutBuilderHtmlEntityFormController::getContentResult | public | function | Invokes the form and returns the result. | Overrides FormController::getContentResult | |
| LayoutBuilderHtmlEntityFormController::getFormArgument | protected | function | Extracts the form argument string from a request. | Overrides FormController::getFormArgument | |
| LayoutBuilderHtmlEntityFormController::getFormObject | protected | function | Returns the object used to build the form. | Overrides FormController::getFormObject | |
| LayoutBuilderHtmlEntityFormController::__construct | public | function | Constructs a LayoutBuilderHtmlEntityFormController object. | Overrides FormController::__construct | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
