You are here

workbench_email_test.module in Workbench Email 8

Same filename and directory in other branches
  1. 2.x tests/modules/workbench_email_test/workbench_email_test.module

Contains main module functions.

File

tests/modules/workbench_email_test/workbench_email_test.module
View source
<?php

/**
 * @file
 * Contains main module functions.
 */
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_ENTITY_TYPE_access().
 */
function workbench_email_test_node_access(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($account
    ->getEmail() === 'editor2@example.com' && $operation === 'update') {
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}

Functions