function LayoutBuilderIntegration::supportQuickEditOnComponent

Determines whether a component has Quick Edit support.

Only field_block components for display configurable fields should be supported.

Parameters

array $component: The component render array.

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity being displayed.

Return value

bool Whether Quick Edit is supported on the component.

See also

\Drupal\layout_builder\Plugin\Block\FieldBlock

1 call to LayoutBuilderIntegration::supportQuickEditOnComponent()
LayoutBuilderIntegration::entityViewAlter in core/modules/quickedit/src/LayoutBuilderIntegration.php
Alters the entity view build for Layout Builder compatibility.

File

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

Class

LayoutBuilderIntegration
Helper methods for Layout Builder module integration.

Namespace

Drupal\quickedit

Code

private function supportQuickEditOnComponent(array $component, FieldableEntityInterface $entity) {
    if (isset($component['content']['#field_name'], $component['#base_plugin_id']) && $component['#base_plugin_id'] === 'field_block' && $entity->hasField($component['content']['#field_name'])) {
        return $entity->getFieldDefinition($component['content']['#field_name'])
            ->isDisplayConfigurable('view');
    }
    return FALSE;
}

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