get('config_schema_test_exception_add')) { $definitions['config_schema_test.hook_added_definition'] = $definitions['config_schema_test.hook']; } if (\Drupal::state()->get('config_schema_test_exception_remove')) { unset($definitions['config_schema_test.hook']); } // Since code can not be unloaded only alter the definition if it exists. if (isset($definitions['config_schema_test.hook'])) { $definitions['config_schema_test.hook']['additional_metadata'] = 'new schema info'; } }