function Textarea::getTranslationElement
Same name in other branches
- 9 core/modules/config_translation/src/FormElement/Textarea.php \Drupal\config_translation\FormElement\Textarea::getTranslationElement()
- 10 core/modules/config_translation/src/FormElement/Textarea.php \Drupal\config_translation\FormElement\Textarea::getTranslationElement()
- 11.x core/modules/config_translation/src/FormElement/Textarea.php \Drupal\config_translation\FormElement\Textarea::getTranslationElement()
Overrides FormElementBase::getTranslationElement
File
-
core/
modules/ config_translation/ src/ FormElement/ Textarea.php, line 15
Class
- Textarea
- Defines the textarea element for the configuration translation interface.
Namespace
Drupal\config_translation\FormElementCode
public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
// Estimate a comfortable size of the input textarea.
$rows_words = ceil(str_word_count($translation_config) / 5);
$rows_newlines = substr_count($translation_config, "\n") + 1;
$rows = max($rows_words, $rows_newlines);
return [
'#type' => 'textarea',
'#rows' => $rows,
] + 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.