Domanda

We are using the poll module and need to override poll default message.

Basically we try with stringoverride module and also use inside the hook_form_alter, used drupal_get_messages() function but not working.

Thanks

È stato utile?

Soluzione 2

You need to alter the submit callback using the "hook_form_alter" hook to define your own callback :

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'poll_view_voting') {
    $form['vote']['#submit'] = array('_my_poll_submit');
  }
}

then you copy paste the code from the "poll_vote" function (in the "poll.module" file) in your callback function and you change the message as needed:

function _my_poll_submit(&$form, &$form_state) {
  $node = $form['#node'];
  //etc ...
  //and at the end:
  drupal_set_message(t('My text for your vote was recorded.'));
}

Altri suggerimenti

This module will help you to override string messages.

https://drupal.org/project/stringoverrides

Regards.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top