function quickedit_preprocess_entity_page_title

Implements hook_preprocess_entity_page_title().

File

core/modules/quickedit/quickedit.module, line 151

Code

function quickedit_preprocess_entity_page_title(&$variables) {
    $variables['#cache']['contexts'][] = 'user.permissions';
    $entity = $variables['entity'];
    if (!\Drupal::currentUser()->hasPermission('access in-place editing')) {
        return;
    }
    if ($entity instanceof RevisionableInterface && !$entity->isLatestRevision()) {
        return;
    }
    $label_field = $entity->getEntityType()
        ->getKey('label');
    $variables['attributes']['data-quickedit-field-id'] = $entity->getEntityTypeId() . '/' . $entity->id() . '/' . $label_field . '/' . $entity->language()
        ->getId() . '/' . $variables['view_mode'];
}

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