How can a description be added to the body field summary widget in node edit form? On a particular content type I have made summary input required by checking both
&quot;Summary Input&quot; and &quot;Summary required&quot; 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 =&amp; $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?
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.');
}