Checks for access to route.
\Symfony\Component\Routing\Route $route: The route to check against.
\Symfony\Component\HttpFoundation\Request $request: The request object.
mixed TRUE if access is allowed. FALSE if not. NULL if no opinion.
Overrides AccessCheckInterface::access
public function access(Route $route, Request $request) {
if ($entity_type = $request->attributes
->get('entity_type')) {
$bundle = $request->attributes
->get('bundle');
$view_mode = $request->attributes
->get('view_mode');
$view_mode_settings = field_view_mode_settings($entity_type, $bundle);
$visibility = $view_mode == 'default' || !empty($view_mode_settings[$view_mode]['status']);
if ($visibility) {
$permission = $route
->getRequirement('_field_ui_view_mode_access');
return user_access($permission);
}
}
}