Reputation: 1435
I have the following code in my module:
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'comment_node_blog_form') {
$form['#node']->content['links']['comment']['#links']['comment-add']['title'] = t('Post a comment');
$form['#node']->actions['submit'] = t('Post comment');
unset($form['#node']->actions['preview']);
var_dump($form);
}
When I look at the var_dump, the form fields are set as intended. However, in looking at the form, the title still has "Add new comment", the submit button is unchanged, and the preview button is still present.
In searching the page content (including the var_dump output) the ONLY place 'Add' exists is in the text of the form ... NOT in the content of the var_dump. The only way I can see that happening is if the form array is being changed back after my hook, so I tried changing the module weight to 99 (via mysql) and clearing cache. No difference.
Upvotes: 0
Views: 28
Reputation: 1
function modulename_form_alter(&$form, &$form_state, $form_id)
{ unset($form['actions']['preview']); }
Upvotes: 0