bulk_edit_terms-8.x-1.1/tests/modules/bulk_edit_terms_field_permissions_test/bulk_edit_terms_field_permissions_test.module

tests/modules/bulk_edit_terms_field_permissions_test/bulk_edit_terms_field_permissions_test.module
<?php

/**
 * @file
 * Module file for Bulk Edit Terms field permissions test.
 */

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Access\AccessResultInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Field\FieldItemListInterface;

/**
 * Implements hook_entity_field_access().
 */
function bulk_edit_terms_field_permissions_test_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface {
  // Prevent access for anyone to edit the tags field.
  if ($field_definition->getName() === 'field_tags' && $operation == 'edit') {
    return AccessResult::forbidden();
  }
  return AccessResult::neutral();
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc