Projet

Général

Profil

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

root / htmltest / sites / all / modules / fivestar / includes / fivestar.admin.inc @ a5572547

1 85ad3d82 Assos Assos
<?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
function fivestar_settings_submit($form, &$form_state) {
41
  drupal_set_message(t('Your settings have been saved.'));
42
  // TODO We could delete all variables for removed tags
43
  variable_set('fivestar_tags', $form_state['values']['tags']);
44
}