5 use Drupal\Core\Entity\EntityAccessControlHandlerInterface;
8 * Defines an interface for file access handlers that need to run on file formatters.
10 * \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase,
11 * which file and image formatters extend, checks 'view' access on the
12 * referenced files before displaying them. That check would be useless and
13 * costly with Core's default access control implementation for files
14 * (\Drupal\file\FileAccessControlHandler grants access based on whether
15 * there are existing entities with granted access that reference the file). But
16 * it might be needed if a different access control handler with different logic
19 * \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase thus adjusts that
20 * behavior, and only checks access if the access control handler in use for
21 * files opts in by implementing this interface.
23 * @see \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase::needsAccessCheck()
25 interface FileAccessFormatterControlHandlerInterface extends EntityAccessControlHandlerInterface { }