isDisplayed(); } /** * {@inheritdoc} */ protected function checkAccess(EntityInterface $entity) { // Only check access if the current file access control handler explicitly // opts in by implementing FileAccessFormatterControlHandlerInterface. $access_handler_class = $entity->getEntityType()->getHandlerClass('access'); if (is_subclass_of($access_handler_class, '\Drupal\file\FileAccessFormatterControlHandlerInterface')) { return $entity->access('view', NULL, TRUE); } else { return AccessResult::allowed(); } } }