b70f5357491365f0e5a0bf0a1235c1088d7aaf00
[yaffs-website] / web / modules / contrib / filefield_sources / src / Access / FieldAccessCheck.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\filefield_sources\Access\FieldAccessCheck.
6  */
7
8 namespace Drupal\filefield_sources\Access;
9
10 use Drupal\Core\Routing\Access\AccessInterface as RoutingAccessInterface;
11 use Drupal\Core\Session\AccountInterface;
12
13 /**
14  * Access check for file field source routes.
15  */
16 class FieldAccessCheck implements RoutingAccessInterface {
17
18   /**
19    * Checks access.
20    *
21    * @param string $entity_type
22    *   Entity type.
23    * @param string $bundle_name
24    *   Bundle name.
25    * @param string $field_name
26    *   Field name.
27    * @param \Drupal\Core\Session\AccountInterface $account
28    *   The currently logged in account.
29    *
30    * @return string
31    *   A \Drupal\Core\Access\AccessInterface constant value.
32    */
33   public function access($entity_type, $bundle_name, $field_name, AccountInterface $account) {
34     $field = entity_load('field_config', $entity_type . '.' . $bundle_name . '.' . $field_name);
35     return $field->access('edit', $account, TRUE);
36   }
37
38 }