<?php

use Drupal\Core\Entity\EntityTypeInterface;

/**
 * Implements hook_entity_base_field_info_alter().
 */
function kamihaya_cms_access_control_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type): void {
  if ($entity_type->id() == 'user') {
    if (isset($fields['mail'])) {
      // Allow user mail field visibilty to be configured from manage display section.
      $fields['mail']->setDisplayConfigurable('view', TRUE);
    }
  }
}
