function ShortcutAccessControlHandler::checkCreateAccess

Same name in other branches
  1. 8.9.x core/modules/shortcut/src/ShortcutAccessControlHandler.php \Drupal\shortcut\ShortcutAccessControlHandler::checkCreateAccess()
  2. 10 core/modules/shortcut/src/ShortcutAccessControlHandler.php \Drupal\shortcut\ShortcutAccessControlHandler::checkCreateAccess()
  3. 11.x core/modules/shortcut/src/ShortcutAccessControlHandler.php \Drupal\shortcut\ShortcutAccessControlHandler::checkCreateAccess()

Overrides EntityAccessControlHandler::checkCreateAccess

File

core/modules/shortcut/src/ShortcutAccessControlHandler.php, line 65

Class

ShortcutAccessControlHandler
Defines the access control handler for the shortcut entity type.

Namespace

Drupal\shortcut

Code

protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
    if ($shortcut_set = $this->shortcutSetStorage
        ->load($entity_bundle)) {
        return shortcut_set_edit_access($shortcut_set, $account);
    }
    // @todo Fix this bizarre code: how can a shortcut exist without a shortcut
    // set? The above if-test is unnecessary. See https://www.drupal.org/node/2339903.
    return AccessResult::neutral();
}

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