You are here

public static function YamlFormAccess::checkEntityResultsAccess in YAML Form 8

Check whether the user can access an entity's form results.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity.

\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

src/Access/YamlFormAccess.php, line 90

Class

YamlFormAccess
Defines the custom access control handler for the form entities.

Namespace

Drupal\yamlform\Access

Code

public static function checkEntityResultsAccess(EntityInterface $entity, AccountInterface $account) {
  return AccessResult::allowedIf($entity
    ->access('update') && $entity
    ->hasField('yamlform') && $entity->yamlform->entity);
}