Projet

Général

Profil

Révision c304a780

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ctools/plugins/arguments/term.inc
2 2

  
3 3
/**
4 4
 * @file
5
 *
6
 * Plugin to provide an argument handler for a Taxonomy term
5
 * Plugin to provide an argument handler for a Taxonomy term.
7 6
 */
8 7

  
9 8
/**
......
12 11
 */
13 12
$plugin = array(
14 13
  'title' => t("Taxonomy term: ID"),
15
  // keyword to use for %substitution
14
  // Keyword to use for %substitution.
16 15
  'keyword' => 'term',
17 16
  'description' => t('Creates a single taxonomy term from a taxonomy ID or taxonomy term name.'),
18 17
  'context' => 'ctools_term_context',
......
67 66
            foreach ($vocabularies as $machine_name) {
68 67
              if ($potential->vocabulary_machine_name == $machine_name) {
69 68
                $term = $potential;
70
                // break out of the foreaches AND the case
69
                // Break out of the foreaches AND the case.
71 70
                break 3;
72 71
              }
73 72
            }
......
92 91
}
93 92

  
94 93
/**
95
 * Settings form for the argument
94
 * Settings form for the argument.
96 95
 */
97 96
function ctools_term_settings_form(&$form, &$form_state, $conf) {
98 97
  // @todo allow synonym use like Views does.
......
137 136
    '#type' => 'checkbox',
138 137
    '#default_value' => !empty($conf['transform']),
139 138
  );
140
//  return $form;
141 139
}
142 140

  
143
function ctools_term_settings_form_validate (&$form, &$form_state) {
141
function ctools_term_settings_form_validate(&$form, &$form_state) {
144 142
  // Filter the selected vocabularies to avoid storing redundant data.
145 143
  $vocabularies = array_filter($form_state['values']['settings']['vocabularies']);
146 144
  form_set_value($form['settings']['vocabularies'], $vocabularies, $form_state);
......
157 155
        '#type' => 'textfield',
158 156
        '#description' => t('Enter a taxonomy term ID.'),
159 157
      );
158

  
160 159
    case 'term':
161 160
      return array(
162 161
        '#type' => 'textfield',
......
190 189
 *
191 190
 * @param array $vids
192 191
 *   Array of either vids.
192
 *
193 193
 * @return array
194 194
 *   A keyed array of machine names.
195 195
 */
196 196
function _ctools_term_vocabulary_machine_name_convert($vids) {
197 197
  $vocabularies = taxonomy_vocabulary_load_multiple($vids);
198 198
  $return = array();
199
  foreach($vocabularies as $vocabulary) {
199
  foreach ($vocabularies as $vocabulary) {
200 200
    $return[$vocabulary->machine_name] = $vocabulary->machine_name;
201 201
  }
202 202
  return $return;

Formats disponibles : Unified diff