function LayoutBuilderIntegration::deconstructViewModeId

Deconstructs the Quick Edit view mode ID into its constituent parts.

Parameters

string $quick_edit_view_mode_id: The Quick Edit view mode ID.

Return value

array An array containing the entity view mode ID, the delta, the component UUID, and the entity ID.

See also

\Drupal\quickedit\LayoutBuilderIntegration::getViewModeId()

2 calls to LayoutBuilderIntegration::deconstructViewModeId()
LayoutBuilderIntegration::quickEditRenderField in core/modules/quickedit/src/LayoutBuilderIntegration.php
Re-renders a field rendered by Layout Builder, edited with Quick Edit.
QuickEditLayoutBuilderEntityViewDisplay::getQuickEditSectionComponent in core/modules/quickedit/src/Entity/QuickEditLayoutBuilderEntityViewDisplay.php
Returns the Quick Edit formatter settings.

File

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

Class

LayoutBuilderIntegration
Helper methods for Layout Builder module integration.

Namespace

Drupal\quickedit

Code

public static function deconstructViewModeId($quick_edit_view_mode_id) {
    [
        ,
        $entity_view_mode_id,
        $delta,
        $component_uuid,
        $entity_id,
    ] = explode('-', $quick_edit_view_mode_id, 7);
    return [
        $entity_view_mode_id,
        // @todo Explicitly cast delta to an integer, remove this in
        //   https://www.drupal.org/project/drupal/issues/2984509.
(int) $delta,
        // Replace the underscores with dash to get back the component UUID.
str_replace('_', '-', $component_uuid),
        $entity_id,
    ];
}

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