I want a value to be automatically added to the title text-field in the comment form ; this value would be indeed the current node title.
I've started working on a hook_form_alter()
(added in a custom module already installed and enabled) like this one :
function ta_module_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'comment-form') {
$form['comment']['title']['#value'] = 'Blablabla';
}
}
But as you might guess it's not working... I've got several issues:
Is the
$form_id
the right one ?I didn't manage to successfully use
print_r($form)
(or it returned nothing) so I guessed the path to the title value. Might be incorrect too...- And finally, I really don't know how to get the current node title variable, so as to attribute it the title value!
Thanks for reading, I hope I've been understandable ! ;)