1

The Body field of the content on our website is generally quite large -- multiple pages. When Editing in Drupal 8, the Input Area is quite small -- 98 characters wide by 9 lines. The first thing we do is drag the bottom right of the Input Area and increase the size to 30-40 lines. This makes editing much easier.

Is there a way to make the Body Input Area size 30 lines long for our website? This would eliminate one step on every Edit!

2 Answers 2

5

You can go to the content types (or paragraph type) Form display settings and set the number of rows. No dev needed:

enter image description here

e.g. /admin/structure/types/manage/content_type/form-display

  1. Click on the gear in the right column
  2. Click update
  3. Click save at the bottom
1
  • Perfect. Thank you!!
    – Greg Sims
    Dec 16, 2020 at 15:04
0

This can be done by setting #rows for the textfield widget in hook_form_alter().

This should work regardless of whether you are using CKEditor or a regular textarea form element.

For example (using hook_form_FORM_ID_alter() which requires you to target the node edit form with FORM_ID),

/**
 * Implements hook_form_FORM_ID_alter().
 */
function mymodule_hook_form_FORM_ID_alter(&$form, FormStateInterface $form_state, $form_id) {
  $form['body']['widget'][0]['value']['#rows'] = 30;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.