function quickedit_page_attachments

quickedit_page_attachments(array &$page)

Implements hook_page_attachments().

Adds the quickedit library to the page for any user who has the 'access in-place editing' permission.

File

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

Code

function quickedit_page_attachments(array &$page) {
  if (!\Drupal::currentUser()->hasPermission('access in-place editing')) {
    return;
  }

  // In-place editing is only supported on the front-end.
  if (\Drupal::service('router.admin_context')->isAdminRoute()) {
    return;
  }

  $page['#attached']['library'][] = 'quickedit/quickedit';
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!quickedit!quickedit.module/function/quickedit_page_attachments/8.1.x