function ConfigTranslationHooks::configSchemaInfoAlter

Implements hook_config_schema_info_alter().

File

core/modules/config_translation/src/Hook/ConfigTranslationHooks.php, line 199

Class

ConfigTranslationHooks
Hook implementations for config_translation.

Namespace

Drupal\config_translation\Hook

Code

public function configSchemaInfoAlter(&$definitions) {
    $map = [
        'label' => '\\Drupal\\config_translation\\FormElement\\Textfield',
        'text' => '\\Drupal\\config_translation\\FormElement\\Textarea',
        'date_format' => '\\Drupal\\config_translation\\FormElement\\DateFormat',
        'text_format' => '\\Drupal\\config_translation\\FormElement\\TextFormat',
        'mapping' => '\\Drupal\\config_translation\\FormElement\\ListElement',
        'sequence' => '\\Drupal\\config_translation\\FormElement\\ListElement',
        'plural_label' => '\\Drupal\\config_translation\\FormElement\\PluralVariants',
    ];
    // 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.
    foreach ($definitions as $type => &$definition) {
        if (isset($map[$type]) && !isset($definition['form_element_class'])) {
            $definition['form_element_class'] = $map[$type];
        }
    }
}

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