function QuickEditIntegration::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 QuickEditIntegration::supportQuickEditOnComponent()
QuickEditIntegration::entityViewAlter in core/modules/layout_builder/src/QuickEditIntegration.php
Alters the entity view build for Quick Edit compatibility.

File

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

Class

QuickEditIntegration
Helper methods for Quick Edit module integration.

Namespace

Drupal\layout_builder

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.