2

I am pretty new to Drupal and simply cant figure it out. I've set up a comment type for a content type. I want to use the default subject field as comment title and want to make it required.

I know, I could simply create a text field named "title" and make it required. But if I manage the comments in backend, there will always be (no subject) in the comments overview list. Is there any way to set it to required?

Thanks in advance!

1 Answer 1

5

Here is how, you will need to create a custom module , and add this ... to yourmodule.module file ...

/** * Implements hook_form_alter(). */ function yourmodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id === 'comment_comment_form') { $form['subject']['widget'][0]['value']['#required'] = TRUE; } } 
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.