You are here

function hook_config_schema_info_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/core.api.php \hook_config_schema_info_alter()
  2. 9 core/core.api.php \hook_config_schema_info_alter()

Alter config typed data definitions.

For example you can alter the typed data types representing each configuration schema type to change default labels or form element renderers used for configuration translation.

If implementations of this hook add or remove configuration schema a ConfigSchemaAlterException will be thrown. Keep in mind that there are tools that may use the configuration schema for static analysis of configuration files, like the string extractor for the localization system. Such systems won't work with dynamically defined configuration schemas.

For adding new data types use configuration schema YAML files instead.

Parameters

$definitions: Associative array of configuration type definitions keyed by schema type names. The elements are themselves array with information about the type.

See also

\Drupal\Core\Config\TypedConfigManager

\Drupal\Core\Config\Schema\ConfigSchemaAlterException

Related topics

3 functions implement hook_config_schema_info_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

ckeditor5_config_schema_info_alter in core/modules/ckeditor5/ckeditor5.module
Implements hook_config_schema_info_alter().
config_schema_test_config_schema_info_alter in core/modules/config/tests/config_schema_test/config_schema_test.module
Implements hook_config_schema_info_alter().
config_translation_config_schema_info_alter in core/modules/config_translation/config_translation.module
Implements hook_config_schema_info_alter().
1 invocation of hook_config_schema_info_alter()
TypedConfigManager::__construct in core/lib/Drupal/Core/Config/TypedConfigManager.php
Creates a new typed configuration manager.

File

core/core.api.php, line 2266
Documentation landing page and topics, plus core library hooks.

Code

function hook_config_schema_info_alter(&$definitions) {

  // Enhance the text and date type definitions with classes to generate proper
  // form elements in ConfigTranslationFormBase. Other translatable types will
  // appear as a one line textfield.
  $definitions['text']['form_element_class'] = '\\Drupal\\config_translation\\FormElement\\Textarea';
  $definitions['date_format']['form_element_class'] = '\\Drupal\\config_translation\\FormElement\\DateFormat';
}