Chris@0: shortcutSetStorage = $shortcut_set_storage; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { Chris@0: return new static( Chris@0: $entity_type, Chris@0: $container->get('entity.manager')->getStorage('shortcut_set') Chris@0: ); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { Chris@0: if ($shortcut_set = $this->shortcutSetStorage->load($entity->bundle())) { Chris@0: return shortcut_set_edit_access($shortcut_set, $account); Chris@0: } Chris@0: // @todo Fix this bizarre code: how can a shortcut exist without a shortcut Chris@0: // set? The above if-test is unnecessary. See https://www.drupal.org/node/2339903. Chris@0: return AccessResult::neutral()->addCacheableDependency($entity); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { Chris@0: if ($shortcut_set = $this->shortcutSetStorage->load($entity_bundle)) { Chris@0: return shortcut_set_edit_access($shortcut_set, $account); Chris@0: } Chris@0: // @todo Fix this bizarre code: how can a shortcut exist without a shortcut Chris@0: // set? The above if-test is unnecessary. See https://www.drupal.org/node/2339903. Chris@0: return AccessResult::neutral(); Chris@0: } Chris@0: Chris@0: }