function LayoutBuilderIntegration::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\quickedit\LayoutBuilderIntegration::deconstructViewModeId()
1 call to LayoutBuilderIntegration::getViewModeId()
- 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 196
Class
- LayoutBuilderIntegration
- Helper methods for Layout Builder module integration.
Namespace
Drupal\quickeditCode
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,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.