Projet

Général

Profil

Paste
Télécharger (2,59 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / i18n / i18n_select / i18n_select.variable.inc @ 76df55b7

1
<?php
2
/**
3
 * @file
4
 * Variable information
5
 */
6

    
7
/**
8
 * Implements hook_variable_info().
9
 */
10
function i18n_select_variable_info($options = array()) {
11
  $variables['i18n_select_nodes'] = array(
12
    'title' => t('Select nodes by language', array(), $options),
13
    'type' => 'boolean',
14
    'default' => TRUE,
15
    'group' => 'i18n',
16
  );
17
  $variables['i18n_select_taxonomy'] = array(
18
    'title' => t('Select taxonomy terms by language', array(), $options),
19
    'type' => 'boolean',
20
    'default' => TRUE,
21
    'group' => 'i18n',
22
    'element' => array('#disabled' => !module_exists('i18n_taxonomy')),
23
  );
24

    
25
  // Enable / disable for specific pages
26
  $description = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'), $options);
27
  if (module_exists('php')) {
28
    $title = t('Pages or PHP code');
29
    $description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>'), $options);
30
  }
31
  else {
32
    $title = t('Pages', array(), $options);
33
  }
34
  $variables['i18n_select_page_mode'] = array(
35
    'type' => 'select',
36
    'options callback' => 'i18n_select_variable_option_list',
37
    'default' => I18N_SELECT_PAGE_NOTLISTED,
38
  );
39
  $variables['i18n_select_page_list'] = array(
40
    'type' => 'text',
41
    'title' => $title,
42
    'default' => 'admin/*',
43
    'description' => $description,
44
  );
45
  $variables['i18n_select_page_block'] = array(
46
    'type' => 'boolean',
47
    'title' => t('Enable always for block content though it may be disabled for the page', array(), $options),
48
    'default' => TRUE,
49
  );
50
  $variables['i18n_select_skip_tags'] = array(
51
    'title' => t('Skip tags', array(), $options),
52
    'type' => 'string',
53
    'default' => 'views',
54
    'group' => 'i18n',
55
    'description' => t('Skip queries with these tags. Enter a list of tags separated by commas.'),
56
    'localize' => FALSE,
57
  );
58
  return $variables;
59
}
60

    
61
/**
62
 * Options for page selection mode
63
 */
64
function i18n_select_variable_option_list($variable, $options = array()) {
65
  $options = array(
66
    I18N_SELECT_PAGE_NOTLISTED => t('All pages except those listed', array(), $options),
67
    I18N_SELECT_PAGE_LISTED => t('Only the listed pages', array(), $options),
68
  );
69
  if (module_exists('php')) {
70
    $options += array(I18N_SELECT_PAGE_PHP => t('Pages on which this PHP code returns <code>TRUE</code> (experts only)'));
71
  }
72
  return $options;
73
}