You are here

private function QuickEditIntegration::buildEntityView in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/QuickEditIntegration.php \Drupal\layout_builder\QuickEditIntegration::buildEntityView()

@todo Replace this hardcoded processing when https://www.drupal.org/project/drupal/issues/3041635 is resolved.

See also

\Drupal\Tests\EntityViewTrait::buildEntityView()

1 call to QuickEditIntegration::buildEntityView()
QuickEditIntegration::quickEditRenderField in core/modules/layout_builder/src/QuickEditIntegration.php
Re-renders a field rendered by Layout Builder, edited with Quick Edit.

File

core/modules/layout_builder/src/QuickEditIntegration.php, line 275

Class

QuickEditIntegration
Helper methods for Quick Edit module integration.

Namespace

Drupal\layout_builder

Code

private function buildEntityView(array &$elements) {

  // If the default values for this element have not been loaded yet,
  // populate them.
  if (isset($elements['#type']) && empty($elements['#defaults_loaded'])) {
    $elements += \Drupal::service('element_info')
      ->getInfo($elements['#type']);
  }

  // Make any final changes to the element before it is rendered. This means
  // that the $element or the children can be altered or corrected before
  // the element is rendered into the final text.
  if (isset($elements['#pre_render'])) {
    foreach ($elements['#pre_render'] as $callable) {
      $elements = call_user_func($callable, $elements);
    }
  }

  // And recurse.
  $children = Element::children($elements, TRUE);
  foreach ($children as $key) {
    $this
      ->buildEntityView($elements[$key]);
  }
}