Project

General

Profile

Revision 01f36513

Added by Assos Assos about 6 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/i18n/i18n_string/i18n_string.variable.inc
34 34
    'default' => 0,
35 35
    'group' => 'debug',
36 36
  );
37
  $variables['i18n_string_textgroup_class_[textgroup]'] = array(
38
    'title' => t('Class to use for the text group'),
39
    'description' => t('Determines which the class will be use for string translation in the text group.', array(), $options),
40
    'repeat' => array(
41
      'type' => 'select',
42
      'default' => 'i18n_string_textgroup_default',
43
      'options callback' => 'i18n_string_variable_textgroup_class_list',
44
    ),
45
    'submit callback' => 'i18n_string_variable_textgroup_class_submit_callback',
46
    'group' => 'i18n',
47
  );
37 48
  return $variables;
38 49
}
39 50

  
51
/**
52
 * Implements hook_variable_type_info().
53
 */
54
function i18n_string_variable_type_info() {
55
  $type['textgroup'] = array(
56
    'title' => t('Text group'),
57
    'type' => 'select',
58
    'options callback' => 'i18n_string_variable_textgroup_list',
59
  );
60
  return $type;
61
}
62

  
40 63
/**
41 64
 * Options callback, format list
42 65
 */
......
54 77
 */
55 78
function i18n_string_variable_format_default() {
56 79
  return array(filter_fallback_format());
57
}
80
}
81

  
82
/**
83
 * Options callback, text groups list.
84
 */
85
function i18n_string_variable_textgroup_list() {
86
  $groups = array();
87
  foreach (i18n_string_group_info() as $name => $info) {
88
    $groups[$name] = $info['title'];
89
  }
90
  return $groups;
91
}
92

  
93
/**
94
 * Options callback, text group classes list.
95
 */
96
function i18n_string_variable_textgroup_class_list($variable, $options = array()) {
97
  return array(
98
    'i18n_string_textgroup_default' => t('Text group handler default.', array(), $options),
99
    'i18n_string_textgroup_cached' => t('Text group handler which include persistent caching.', array(), $options),
100
  );
101
}
102

  
103
/**
104
 * Submit callback. Execute Reset the persistent caches after save the text group class variables.
105
 */
106
function i18n_string_variable_textgroup_class_submit_callback($variable, $options, $form, $form_state) {
107
  // Reset the persistent caches.
108
  cache_clear_all('i18n:string:' , 'cache', TRUE);
109
}

Also available in: Unified diff