On a particular content type I have made summary input required by checking both "Summary Input" and "Summary required" on the body field settings.

We would like to add a help text to the summary field on the resulting form. I have tried using hook_form_BASE_FORM_ID_alter as seen below which is working for the title field.

$title_description = 'Why we need a title.';
$title_widget =& $form['title']['widget'];
if (empty($title_widget[0]['value']['#description'])) {
  $title_widget[0]['value']['#description'] = $title_description;

I am having a hard time finding the summary in the $form array however.

To recap how can I alter this widget to add a description?

1 Answer 1


I assume you're using Drupal 8.

Try the below in your hook alter. This also assumes the usage of the default body field in use:

use Drupal\Core\StringTranslation\TranslatableMarkup;

// Ensure summary field existence.
if (isset($form['body']['widget'][0]['summary'])) {
  $form['body']['widget'][0]['summary']['#description'] = new TranslatableMarkup('Your summary description goes here.');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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