Our use case is to get rid of ranking poll, but, well, might as well make it a hookable system.

Here's some api for the hooks, but didn't see any place to put them so not in patch.

/**
 * Returns advpoll modes
 *
 * @return array
 *   An array of modes
 *
 *   'name': mode key, used to identify the mode.
 *
 *   'name_label': The title/label of the mode, used for user interface.
 *
 *   'description': Description of the type.
 */
function hook_advpoll_info() {
  return array(
    'mypoll' => array(
      'name' => 'mypoll',
      'name_label' => t('My poll type'),
      'description' => t('Description of my poll type.'),
    ),
  );
}

/**
 * Alter the type of modes available. 
 *
 * @param array $modes
 *   A keyed array of different advpoll modes
 */
function hook_advpoll_alter($modes) {
  unset($modes['mypoll']);
}

Comments

hefox’s picture

(typo with the documentation, should be hook_advpoll_info_alter).

hefox’s picture

StatusFileSize
new577 bytes

Typo in patch also, fail u.u.

(I guess also should documentent that people need to implement the other 'hooks' and how).

hefox’s picture

StatusFileSize
new18.03 KB

Here's an extended patch to convert existing implementations into a full hook system where node type == mode,* and use psuedo hooks like node types do

The 'new' hooks are

hook_advpoll_algorithms
hook_advpoll_voting_form
hook_advpoll_view_results
hook_advpoll_calculate_results
hook_advpoll_voting_form_submit
hook_advpoll_voting_form_validate
hook_advpoll_preprocess_voting_form
hook_advpoll_cancel

though can't find where hook_advpoll_preprocess_voting_form functionality was being used.

* Wanted to do that so the hooks would be named space, if hadn't done it the binary implementations would be binary_blah, eek!

(... all cause I wanted to eradicate ranking poll via a drupal_alter XD).

However without #987462: check advpoll_node_info instead of strstr to determine if advpoll type? still need node type to begin with advpoll.

gobinathm’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

D6 is EOL hence won't be fixing this.