For all textareas, I want to print the help text description above the field input.
By default, it looks like this:
- Field Label
- Field Input
- Help Description
I want to arrange it like this:
- Field Label
- Help Description
- Field Input
This was actually a hidden configuration option added to Drupal 8.0 So, the basic idea is that I have to set '#description_display' => 'before'
for every textarea.
To do that, I tried to use template_preprocess_textarea().
I added the following code to mytheme/mytheme.theme
:
function MYTHEME_preprocess_textarea(&$variables) {
$variables['#description_display'] = 'before';
}
I checked to make sure this code is called with kint()
but it doesn't change the positioning of the help descriptions on the forms. I checked my theme (Bootstrap's) templates and they have logic for handling before
and after
. So what is the right way to call this to adjust the position of the help text on all textareas?