function field_test_field_storage_config_update_forbid

Same name and namespace in other branches
  1. 9 core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_field_storage_config_update_forbid()
  2. 8.9.x core/modules/field/tests/modules/field_test/field_test.field.inc \field_test_field_storage_config_update_forbid()
  3. 11.x 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

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'");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.