You are here

fivestar.admin.inc in Fivestar 7.2

Same filename and directory in other branches
  1. 6.2 includes/fivestar.admin.inc

Configuration pages for Fivestar module.

File

includes/fivestar.admin.inc
View source
<?php

/**
 * @file
 * Configuration pages for Fivestar module.
 */

/**
 * Callback function for admin/settings/fivestar. Display the settings form.
 */
function fivestar_settings($form, $form_state) {
  $form['tags'] = array(
    '#tree' => FALSE,
    '#type' => 'fieldset',
    '#title' => t('Voting tags'),
    '#description' => t('Choose the voting tags that will be available for node rating. A tag is simply a category of vote. If you only need to rate one thing per node, leave this as the default "vote".'),
    '#weight' => 3,
  );
  $form['tags']['tags'] = array(
    '#type' => 'textfield',
    '#title' => t('Tags'),
    '#default_value' => variable_get('fivestar_tags', 'vote'),
    '#required' => TRUE,
    '#description' => t('Separate multiple tags with commas.'),
  );
  $form['#submit'][] = 'fivestar_settings_submit';
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
    '#weight' => 45,
  );
  return $form;
}

/**
 * Submit handler for fivestar_settings() form.
 */
function fivestar_settings_submit($form, &$form_state) {
  drupal_set_message(t('Your settings have been saved.'));

  // @todo We could delete all variables for removed tags.
  variable_set('fivestar_tags', $form_state['values']['tags']);
}

Functions

Namesort descending Description
fivestar_settings Callback function for admin/settings/fivestar. Display the settings form.
fivestar_settings_submit Submit handler for fivestar_settings() form.