Textarea.php in Drupal 9
File
core/modules/config_translation/src/FormElement/Textarea.php
View source
<?php
namespace Drupal\config_translation\FormElement;
use Drupal\Core\Language\LanguageInterface;
class Textarea extends FormElementBase {
public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
$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);
}
}
Classes
Name |
Description |
Textarea |
Defines the textarea element for the configuration translation interface. |