You are here

public function FormModePageAccessCheck::access in Flexiform 8

Flexiform form mode access callback.

File

src/Access/FormModePageAccessCheck.php, line 19

Class

FormModePageAccessCheck
Checks access for displaying configuration translation page.

Namespace

Drupal\flexiform\Access

Code

public function access(EntityFormMode $form_mode, Request $request, AccountInterface $account) {
  $entities = $this
    ->getProvidedEntities($form_mode, $request);
  $access_result = NULL;
  foreach ($entities as $entity) {
    if (!isset($access_result)) {
      $access_result = $entity
        ->access('edit', $account, TRUE);
    }
    else {
      $access_result
        ->andIf($entity
        ->access('edit', $account, TRUE));
    }
  }
  return $access_result;
}