Projet

Général

Profil

Paste
Télécharger (1,25 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / fivestar / includes / fivestar.admin.inc @ d50a36e0

1
<?php
2

    
3
/**
4
 * @file
5
 * Configuration pages for Fivestar module.
6
 */
7

    
8
/**
9
 * Callback function for admin/settings/fivestar. Display the settings form.
10
 */
11
function fivestar_settings($form, $form_state) {
12

    
13
  $form['tags'] = array(
14
    '#tree' => FALSE,
15
    '#type' => 'fieldset',
16
    '#title' => t('Voting tags'),
17
    '#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".'),
18
    '#weight' => 3,
19
  );
20

    
21
  $form['tags']['tags'] = array(
22
    '#type' => 'textfield',
23
    '#title' => t('Tags'),
24
    '#default_value' => variable_get('fivestar_tags', 'vote'),
25
    '#required' => TRUE,
26
    '#description' => t('Separate multiple tags with commas.'),
27
  );
28

    
29
  $form['#submit'][] = 'fivestar_settings_submit';
30

    
31
  $form['submit'] = array(
32
    '#type' => 'submit',
33
    '#value' => t('Save configuration'),
34
    '#weight' => 45,
35
  );
36

    
37
  return $form;
38
}
39

    
40
/**
41
 * Submit handler for fivestar_settings() form.
42
 */
43
function fivestar_settings_submit($form, &$form_state) {
44
  drupal_set_message(t('Your settings have been saved.'));
45
  // @todo We could delete all variables for removed tags.
46
  variable_set('fivestar_tags', $form_state['values']['tags']);
47
}