You are here

function field_test_field_storage_config_update_forbid in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_field_storage_config_update_forbid()

Implements hook_field_storage_config_update_forbid().

File

core/modules/field/tests/modules/field_test/field_test.field.inc, line 34
Defines a field type and its formatters and widgets.

Code

function field_test_field_storage_config_update_forbid(FieldStorageConfigInterface $field_storage, FieldStorageConfigInterface $prior_field_storage) {
  if ($field_storage
    ->getType() == 'test_field' && $field_storage
    ->getSetting('unchangeable') != $prior_field_storage
    ->getSetting('unchangeable')) {
    throw new FieldStorageDefinitionUpdateForbiddenException("field_test 'unchangeable' setting cannot be changed'");
  }
}