summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/page_title/page_title.admin.inc
blob: 2f97e4a2e0bececf2081f16514baf673e6cced56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php

/**
 * @file
 * Admin include file.
 */

/**
 * Displays the form for the standard settings tab.
 *
 * @return
 *   array A structured array for use with Forms API.
 */
function page_title_admin_settings() {
  // Set the page title - the page is a local task now.
  drupal_set_title(t('Page titles'));


  // Set the theme callback for the patterns section
  $form['patterns'] = array(
    '#theme' => 'page_title_admin_settings',
  );

  $all_settings = page_title_get_settings();

  foreach ($all_settings as $key => $settings) {
    $form['patterns']['pattern'][$key] = array(
      '#title' => t($settings['label'], $settings['label arguments']),
      '#default_value' => variable_get($key, $settings['default']),
      '#required' => $settings['required'],
      '#description' => t($settings['description'], $settings['description arguments']),
      '#weight' => $settings['weight'],
      '#token_types' => $settings['scopes'],
      '#element_validate' => array('token_element_validate'),
      '#type' => 'textfield',
      '#size' => 30,
      '#maxlength' => 255,
    );

    $form['patterns']['scope'][$key] = array(
      '#markup' => implode('<br />', array_map('_page_title_scope_t', $settings['scopes'])),
    );

    if ($settings['show field']) {
      $form['patterns']['showfield'][$key . '_showfield'] = array(
        '#type' => 'checkbox',
        '#default_value' => variable_get($key . '_showfield', 0),
      );
    }
  }


  // Add the token help to a collapsed fieldset at the end of the configuration page.
  $form['token_help'] = array(
    '#type' => 'fieldset',
    '#title' => t('Available Tokens List'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['token_help']['content'] = array(
    '#theme' => 'token_tree',
    '#token_types' => array('node', 'comment', 'term', 'vocabulary', 'user'),
  );

  $form = system_settings_form($form);
  return $form;
}



function _page_title_scope_t($item) {
  return t(drupal_ucfirst($item));
}