Upgraded imagemagick and manually altered pdf to image module to handle changes....
[yaffs-website] / web / modules / contrib / entity / src / EntityPermissionProvider.php
1 <?php
2
3 namespace Drupal\entity;
4
5 use Drupal\Core\Entity\EntityTypeInterface;
6
7 /**
8  * Provides generic entity permissions which are still cacheable.
9  *
10  * This includes:
11  *
12  * - administer $entity_type
13  * - access $entity_type overview
14  * - view $entity_type
15  * - view own unpublished $entity_type
16  * - update (own|any) ($bundle) $entity_type
17  * - delete (own|any) ($bundle) $entity_type
18  * - create $bundle $entity_type
19  *
20  * This class does not support "view own ($bundle) $entity_type", because this
21  * results in caching per user. If you need this use case, please use
22  * \Drupal\entity\UncacheableEntityPermissionProvider instead.
23  *
24  * Intended for content entity types, since config entity types usually rely
25  * on a single "administer" permission.
26  * Example annotation:
27  * @code
28  *  handlers = {
29  *    "access" = "Drupal\entity\EntityAccessControlHandler",
30  *    "permission_provider" = "Drupal\entity\EntityPermissionProvider",
31  *  }
32  * @endcode
33  *
34  * @see \Drupal\entity\EntityAccessControlHandler
35  * @see \Drupal\entity\EntityPermissions
36  */
37 class EntityPermissionProvider extends EntityPermissionProviderBase {
38
39   /**
40    * {@inheritdoc}
41    */
42   public function buildPermissions(EntityTypeInterface $entity_type) {
43     $entity_type_id = $entity_type->id();
44     $plural_label = $entity_type->getPluralLabel();
45
46     $permissions = parent::buildPermissions($entity_type);
47
48     // View permissions are the same for both granularities.
49     $permissions["view {$entity_type_id}"] = [
50       'title' => $this->t('View @type', [
51         '@type' => $plural_label,
52       ]),
53     ];
54
55     return $this->processPermissions($permissions, $entity_type);
56   }
57
58
59 }