I'm trying to make the comment author name required with this code:
use Drupal\Core\Form\FormStateInterface; /** * Implements hook_form_FORM_ID_alter(). */ function MODULE_form_comment_comment_form_alter(array &$form, FormStateInterface $form_state, $form_id) { $form['name']['#required'] = true; } But I can't find the way to do so. How to make the comment author name required for anonymous users?