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/contexts/terms.inc
2 2

  
3 3
/**
4 4
 * @file
5
 *
6
 * Plugin to provide a terms context
5
 * Plugin to provide a terms context.
7 6
 */
8 7

  
9 8
/**
......
37 36
function ctools_context_create_terms($empty, $data = NULL, $conf = FALSE) {
38 37
  // The input is expected to be an object as created by ctools_break_phrase
39 38
  // which contains a group of terms.
40

  
41 39
  $context = new ctools_context(array('terms', 'entity:taxonomy_term'));
42 40
  $context->plugin = 'terms';
43 41

  
......
49 47
    $context->operator = $data->operator;
50 48
    $context->tids     = $data->value;
51 49
    if (!isset($data->term)) {
52
      // load the first term:
50
      // Load the first term:
53 51
      reset($context->tids);
54 52
      $data->term = taxonomy_term_load(current($context->tids));
55 53
    }
......
67 65
  switch ($type) {
68 66
    case 'tid':
69 67
      return $context->data->tid;
68

  
70 69
    case 'tids':
71 70
      return $context->argument;
71

  
72 72
    case 'name':
73 73
      return $context->data->name;
74

  
74 75
    case 'name_dashed':
75 76
      return drupal_strtolower(str_replace(' ', '-', $context->data->name));
77

  
76 78
    case 'names':
77 79
    case 'names_dashed':
78 80
      // We only run this query if this item was requested:
......
92 94
        }
93 95
      }
94 96
      return $context->names;
97

  
95 98
    case 'vid':
96 99
      return $context->data->vid;
97 100
  }

Formats disponibles : Unified diff