I need to ensure that the description field in Metatag module is required. How can I do that?
Tried adding this code to metatag.module (to create a custom patch later if it worked) from this article, but this is for Drupal 7. I'm working in Drupal 9:
function metatag_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['metatags'])) {
if (isset($form['metatags']['description']['value'])) {
$form['metatags']['description']['value']['#required'] = TRUE;
}
if (isset($form['metatags']['keywords']['value'])) {
$form['metatags']['keywords']['value']['#required'] = TRUE;
}
}
}
But that didn't work.
Thank you in advance!