class Textarea
Same name in this branch
- 9 core/lib/Drupal/Core/Render/Element/Textarea.php \Drupal\Core\Render\Element\Textarea
Same name and namespace in other branches
- 11.x core/modules/config_translation/src/FormElement/Textarea.php \Drupal\config_translation\FormElement\Textarea
- 11.x core/lib/Drupal/Core/Render/Element/Textarea.php \Drupal\Core\Render\Element\Textarea
- 10 core/modules/config_translation/src/FormElement/Textarea.php \Drupal\config_translation\FormElement\Textarea
- 10 core/lib/Drupal/Core/Render/Element/Textarea.php \Drupal\Core\Render\Element\Textarea
- 8.9.x core/modules/config_translation/src/FormElement/Textarea.php \Drupal\config_translation\FormElement\Textarea
- 8.9.x core/lib/Drupal/Core/Render/Element/Textarea.php \Drupal\Core\Render\Element\Textarea
Defines the textarea element for the configuration translation interface.
Hierarchy
- class \Drupal\config_translation\FormElement\FormElementBase implements \Drupal\config_translation\FormElement\ElementInterface uses \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\config_translation\FormElement\Textarea extends \Drupal\config_translation\FormElement\FormElementBase
Expanded class hierarchy of Textarea
19 string references to 'Textarea'
- AssertLegacyTrait::assertFieldsByValue in core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php - Asserts that a field exists in the current page with a given Xpath result.
- ckeditor5_form_filter_format_form_alter in core/
modules/ ckeditor5/ ckeditor5.module - Implements hook_form_FORM_ID_alter().
- CKEditorStylesComboTranslationTest::testExistingFormat in core/
modules/ ckeditor/ tests/ src/ Functional/ CKEditorStylesComboTranslationTest.php - Tests translations of CKEditor styles configuration.
- ClaroPreRender::textFormat in core/
themes/ claro/ src/ ClaroPreRender.php - Prerender callback for text_format elements.
- ConfigTranslationUiTest::assertDisabledTextarea in core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiTest.php - Asserts that a textarea with a given ID has been disabled from editing.
File
-
core/
modules/ config_translation/ src/ FormElement/ Textarea.php, line 10
Namespace
Drupal\config_translation\FormElementView source
class Textarea extends FormElementBase {
/**
* {@inheritdoc}
*/
public function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
// Estimate a comfortable size of the input textarea.
if (is_string($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 ?? 1,
] + 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.