TextFormat::getSourceElement

public TextFormat::getSourceElement(LanguageInterface $source_language, $source_config)

Returns the source element for a given configuration definition.

This can be either a render array that actually outputs the source values directly or a read-only form element with the source values depending on what is considered to provide a more intuitive user interface for the translator.

Parameters

\Drupal\Core\Language\LanguageInterface $source_language: Thee source language of the configuration object.

mixed $source_config: The configuration value of the element in the source language.

Return value

array A render array for the source value.

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) + array(
    '#value' => $source_config['value'],
    '#disabled' => TRUE,
    '#allow_focus' => TRUE,
  );
}
doc_Drupal
2016-10-29 09:47:39
Comments
Leave a Comment

Please login to continue.