function TextFormat::getTranslationElement

Same name in other branches
  1. 9 core/modules/config_translation/src/FormElement/TextFormat.php \Drupal\config_translation\FormElement\TextFormat::getTranslationElement()
  2. 8.9.x core/modules/config_translation/src/FormElement/TextFormat.php \Drupal\config_translation\FormElement\TextFormat::getTranslationElement()
  3. 10 core/modules/config_translation/src/FormElement/TextFormat.php \Drupal\config_translation\FormElement\TextFormat::getTranslationElement()

Overrides FormElementBase::getTranslationElement

1 call to TextFormat::getTranslationElement()
TextFormat::getSourceElement in core/modules/config_translation/src/FormElement/TextFormat.php
Returns the source element for a given configuration definition.

File

core/modules/config_translation/src/FormElement/TextFormat.php, line 29

Class

TextFormat
Defines the text_format element for the configuration translation interface.

Namespace

Drupal\config_translation\FormElement

Code

public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
    return [
        '#type' => 'text_format',
        // Override the #default_value property from the parent class.
'#default_value' => $translation_config['value'],
        '#format' => $translation_config['format'],
        // @see \Drupal\config_translation\Element\FormElementBase::getTranslationElement()
'#allowed_formats' => [
            $source_config['format'],
        ],
    ] + parent::getTranslationElement($translation_language, $source_config, $translation_config);
}

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