3 namespace Drupal\config_translation\FormElement;
5 use Drupal\Core\Language\LanguageInterface;
8 * Defines the textarea element for the configuration translation interface.
10 class Textarea extends FormElementBase {
15 public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
16 // Estimate a comfortable size of the input textarea.
17 $rows_words = ceil(str_word_count($translation_config) / 5);
18 $rows_newlines = substr_count($translation_config, "\n") + 1;
19 $rows = max($rows_words, $rows_newlines);
22 '#type' => 'textarea',
24 ] + parent::getTranslationElement($translation_language, $source_config, $translation_config);