You are here

private static function QuickEditIntegration::getViewModeId in Drupal 9

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

Generates a Quick Edit view mode ID.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The entity view display.

int $delta: The delta.

string $component_uuid: The component UUID.

string $sections_hash: The hash of the sections; must change whenever the sections change.

Return value

string The Quick Edit view mode ID.

See also

\Drupal\layout_builder\QuickEditIntegration::deconstructViewModeId()

1 call to QuickEditIntegration::getViewModeId()
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 196

Class

QuickEditIntegration
Helper methods for Quick Edit module integration.

Namespace

Drupal\layout_builder

Code

private static function getViewModeId(EntityInterface $entity, EntityViewDisplayInterface $display, $delta, $component_uuid, $sections_hash) {
  return implode('-', [
    'layout_builder',
    $display
      ->getMode(),
    $delta,
    // Replace the dashes in the component UUID because we need to
    // use dashes to join the parts.
    str_replace('-', '_', $component_uuid),
    $entity
      ->id(),
    $sections_hash,
  ]);
}