<?php

/**
 * @file
 * Hooks and customizations for the farm_migrate module.
 */

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_ENTITY_TYPE_access().
 */
function farm_migrate_file_access(EntityInterface $entity, $operation, AccountInterface $account) {

  // Allow access to private file referencing during migration.
  // @see FarmMigrationSubscriber::allowPrivateFileReferencing()
  if (\Drupal::state()->get('farm_migrate_allow_file_referencing')) {
    return AccessResult::allowed();
  }
}
