public function TextFormat::getSourceElement in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/config_translation/src/FormElement/TextFormat.php \Drupal\config_translation\FormElement\TextFormat::getSourceElement()
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 20 - Contains \Drupal\config_translation\FormElement\TextFormat.
Class
- TextFormat
- Defines the text_format element for the configuration translation interface.
Namespace
Drupal\config_translation\FormElementCode
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,
);
}