function FieldTestFieldHooks::fieldStorageConfigUpdateForbid

Implements hook_field_storage_config_update_forbid().

File

core/modules/field/tests/modules/field_test/src/Hook/FieldTestFieldHooks.php, line 39

Class

FieldTestFieldHooks
Hook implementations for field_test.

Namespace

Drupal\field_test\Hook

Code

public function fieldStorageConfigUpdateForbid(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.