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 childAccess(RouteMatch $route_match) : AccessResultInterface { return AccessResult::allowedIf($this->utils->canCreateIslandoraEntity('node', 'node_type')) ->andIf($this->mediaAccess($route_match)); } /** * Check if the user can create any "Islandora" 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 mediaAccess(RouteMatch $route_match) : AccessResultInterface { return AccessResult::allowedIf($this->utils->canCreateIslandoraEntity('media', 'media_type')); } }