function LayoutBuilderIntegration::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 LayoutBuilderIntegration::buildEntityView()
LayoutBuilderIntegration::quickEditRenderField in core/modules/quickedit/src/LayoutBuilderIntegration.php
Re-renders a field rendered by Layout Builder, edited with Quick Edit.

File

core/modules/quickedit/src/LayoutBuilderIntegration.php, line 275

Class

LayoutBuilderIntegration
Helper methods for Layout Builder module integration.

Namespace

Drupal\quickedit

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]);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.