utils = $utils; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) : self { return new static( $container->get('islandora.utils') ); } /** * Check if the user can create any "Islandora" nodes and media. * * @param \Drupal\Core\Routing\RouteMatch $route_match * The current routing match. * * @return \Drupal\Core\Access\AccessResultInterface * Whether we can or cannot show the "thing". */ public function checkAccess(RouteMatch $route_match) : AccessResultInterface { $can_create_media = $this->utils->canCreateIslandoraEntity('media', 'media_type'); $can_create_node = $this->utils->canCreateIslandoraEntity('node', 'node_type'); if ($can_create_media && $can_create_node) { return AccessResult::allowed(); } return AccessResult::forbidden(); } }