Reputation: 11
drupal 7 working fine tested.
/**
* Implementation of hook_form_alter().
*/
function MY_MODULE_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'form_id':
$form['actions']['submit']['#submit'][] = 'MY_MODULE_custom_submit';
break;
}
}
function MY_MODULE_custom_submit($form, &$form_state)
{
//Get current messages and clear them.
$messages = drupal_get_messages('status');
drupal_set_message(t('Your custom status message here!'));
}
Upvotes: 0
Views: 1271
Reputation: 3665
Just need to get the right form_id
in there. So if the node type is article
, use article_node_form
.
Also, don't forget to clear the caches at admin/config/development/performance
so the system sees the changes.
/**
* Implementation of hook_form_alter().
*/
function MY_MODULE_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
// Replace NODETYPE with the machine-readable name of the node type.
case 'NODETYPE_node_form':
$form['actions']['submit']['#submit'][] = 'MY_MODULE_custom_submit';
break;
}
}
function MY_MODULE_custom_submit($form, &$form_state) {
//Get current messages and clear them.
$messages = drupal_get_messages('status');
drupal_set_message(t('Your custom status message here!'));
}
Hope that helps... :)
Upvotes: 3