function TextFormat::getSourceElement

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

Overrides FormElementBase::getSourceElement

File

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

Class

TextFormat
Defines the text_format element for the configuration translation interface.

Namespace

Drupal\config_translation\FormElement

Code

public function getSourceElement(LanguageInterface $source_language, $source_config) {
    // Instead of the formatted output show a disabled textarea. This allows for
    // easier side-by-side comparison, especially with formats with text
    // editors.
    return $this->getTranslationElement($source_language, $source_config, $source_config) + [
        '#value' => $source_config['value'],
        '#disabled' => TRUE,
        '#allow_focus' => TRUE,
    ];
}

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