quickedit_entity_view_alter

quickedit_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display)

Implements hook_entity_view_alter().

File

core/modules/quickedit/quickedit.module, line 155
Provides in-place content editing functionality for fields.

Code

1
2
3
4
5
6
7
8
function quickedit_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
  $build['#cache']['contexts'][] = 'user.permissions';
  if (!\Drupal::currentUser()->hasPermission('access in-place editing')) {
    return;
  }
 
  $build['#attributes']['data-quickedit-entity-id'] = $entity->getEntityTypeId() . '/' . $entity->id();
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.