f1ca2d1d65ef44b598b13757a7206dc8631b8394
[yaffs-website] / web / core / modules / file / src / FileAccessFormatterControlHandlerInterface.php
1 <?php
2
3 namespace Drupal\file;
4
5 use Drupal\Core\Entity\EntityAccessControlHandlerInterface;
6
7 /**
8  * Defines an interface for file access handlers that need to run on file formatters.
9  *
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
17  * is swapped in.
18  *
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.
22  *
23  * @see \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase::needsAccessCheck()
24  */
25 interface FileAccessFormatterControlHandlerInterface extends EntityAccessControlHandlerInterface { }