Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileAccessFormatterControlHandlerInterface.php

interface FileAccessFormatterControlHandlerInterface

Defines an interface for file access handlers that need to run on file formatters.

\Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase, which file and image formatters extend, checks 'view' access on the referenced files before displaying them. That check would be useless and costly with Core's default access control implementation for files (\Drupal\file\FileAccessControlHandler grants access based on whether there are existing entities with granted access that reference the file). But it might be needed if a different access control handler with different logic is swapped in.

\Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase thus adjusts that behavior, and only checks access if the access control handler in use for files opts in by implementing this interface.

Hierarchy

  • interface \Drupal\Core\Entity\EntityAccessControlHandlerInterface
    • interface \Drupal\file\FileAccessFormatterControlHandlerInterface extends \Drupal\Core\Entity\EntityAccessControlHandlerInterface

Expanded class hierarchy of FileAccessFormatterControlHandlerInterface

All classes that implement FileAccessFormatterControlHandlerInterface

See also

\Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase::needsAccessCheck()

File

core/modules/file/src/FileAccessFormatterControlHandlerInterface.php, line 25

Namespace

Drupal\file
View source
interface FileAccessFormatterControlHandlerInterface extends EntityAccessControlHandlerInterface {

}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal