Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How would one override the default "Save" button text on the Comment Form?
I've tried the following in my template.php file:
function node_comment_block_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'comment_form') {
$form['actions']['submit']['#value'] = 'Post Comment';
}
}
function node_comment_block_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'comment-form') {
$form['actions']['submit']['#value'] = 'Post Comment';
}
}
Unless this is a future feature enhancement, I'd rather not modify the module itself since I'll probably forget and apply a future update and override my changes.
Thanks.
Comments
Comment #1
opdaviesI don't think that this is something that we should include within the module, so I'd suggest using a hook_form_alter or hook_form_FORM_ID_alter within a theme's template.php file or within a custom module to make the specific change needed for a site.