You are here

function vote_up_down_admin_settings in Vote Up/Down 5

Same name and namespace in other branches
  1. 6 vote_up_down.module \vote_up_down_admin_settings()

Implementation of hook_settings().

1 string reference to 'vote_up_down_admin_settings'
vote_up_down_menu in ./vote_up_down.module
Implementation of hook_menu().

File

./vote_up_down.module, line 38
vote_up_down is a module that adds a widget for +1/-1 votes on nodes. It depends upon Voting API. It's based upon "simplevote.module".

Code

function vote_up_down_admin_settings() {
  $form['vote_node_types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node types'),
    '#description' => t('Set the node types you want to activate voting on.'),
    '#collapsible' => TRUE,
  );
  $form['vote_node_types']['vote_up_down_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Types'),
    '#default_value' => variable_get('vote_up_down_node_types', array()),
    '#options' => node_get_types('names'),
  );
  $form['vote_widget_settings_node'] = array(
    '#type' => 'fieldset',
    '#title' => t('Vote widget settings for nodes'),
    '#description' => t('For more control over the voting widget placement it can be inserted directly in the theme, see the included template.php and node-storylink.tpl.php for an example. When this method is used turn off the widget display here.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['vote_widget_settings_node']['vote_up_down_widget_style_node'] = array(
    '#type' => 'radios',
    '#title' => t('Vote widget style'),
    '#default_value' => variable_get('vote_up_down_widget_style_node', 0),
    '#options' => array(
      0 => t('Default +1/-1 vote style'),
      1 => t('Alternative +1 vote style'),
    ),
    '#description' => t('If set to alternative style it\'s recomended to turn off the link display of vote points.'),
  );
  $form['vote_widget_settings_node']['vote_up_down_widget_node'] = array(
    '#type' => 'select',
    '#title' => t('Vote widget display'),
    '#default_value' => variable_get('vote_up_down_widget_node', 3),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Teaser view'),
      2 => t('Full-page view'),
      3 => t('Teasers and full-page view'),
    ),
    '#description' => t('When to display the vote widget for nodes.'),
  );
  $form['vote_widget_settings_node']['vote_up_down_link_node'] = array(
    '#type' => 'select',
    '#title' => t('Link display of vote points'),
    '#default_value' => variable_get('vote_up_down_link_node', 3),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Teaser view'),
      2 => t('Full-page view'),
      3 => t('Teasers and full-page view'),
    ),
    '#description' => t('When to display vote points for nodes.'),
  );
  $form['vote_widget_settings_comment'] = array(
    '#type' => 'fieldset',
    '#title' => t('Vote widget settings for comments'),
    '#description' => t('For more control over the voting widget placement it can be inserted directly in the theme, see the included node-storylink.tpl.php for an example. When this metod is used turn off the widget display here.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['vote_widget_settings_comment']['vote_up_down_widget_style_comment'] = array(
    '#type' => 'radios',
    '#title' => t('Vote widget style'),
    '#default_value' => variable_get('vote_up_down_widget_style_comment', 0),
    '#options' => array(
      0 => t('Default +1/-1 vote style'),
      1 => t('Alternative +1 vote style'),
    ),
    '#description' => t('If set to alternative style it\'s recomended to turn off the link display of vote points.'),
  );
  $form['vote_widget_settings_comment']['vote_up_down_widget_comment'] = array(
    '#type' => 'radios',
    '#title' => t('Vote widget display'),
    '#default_value' => variable_get('vote_up_down_widget_comment', 1),
    '#options' => array(
      0 => t('Do not display widget'),
      1 => t('Display widget'),
    ),
  );
  $form['vote_widget_settings_comment']['vote_up_down_link_comment'] = array(
    '#type' => 'radios',
    '#title' => t('Link display of vote points'),
    '#default_value' => variable_get('vote_up_down_link_comment', 1),
    '#options' => array(
      0 => t('Do not display link'),
      1 => t('Display link'),
    ),
  );
  $form['vote_widget_settings_advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['vote_widget_settings_advanced']['vote_up_down_tag'] = array(
    '#type' => 'textfield',
    '#title' => t('Vote tag'),
    '#default_value' => variable_get('vote_up_down_tag', 'vote'),
    '#description' => t('All votes from the Vote up/down module will be tagged with this term. Using a unique value here may be useful when you deploy various voting modules that all use the Voting API. (Default: vote)'),
  );
  $form['vote_widget_settings_advanced']['vote_up_down_anonymous_vote'] = array(
    '#type' => 'radios',
    '#title' => t('Allow anonymous voting'),
    '#default_value' => variable_get('vote_up_down_anonymous_vote', 0),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#description' => t('If yes anonymous users may cast votes, restricted to one vote per day and IP address.'),
  );
  $form['vote_widget_settings_advanced']['vote_up_down_reset_vote'] = array(
    '#type' => 'radios',
    '#title' => t('Allow users to reset their votes'),
    '#default_value' => variable_get('vote_up_down_reset_vote', 0),
    '#options' => array(
      0 => t('No'),
      1 => t('Yes'),
    ),
    '#description' => t('If yes a link will be displayd on nodes and commets that will reset the users votes on that node/comment.'),
  );
  return system_settings_form($form);
}