Projet

Général

Profil

Paste
Télécharger (897 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / includes / views.inc @ c304a780

1
<?php
2

    
3
/**
4
 * @file
5
 */
6

    
7
/**
8
 * Generate new context classes by argument settings on the view.
9
 */
10
function ctools_views_get_argument_context($argument) {
11
  if ($argument['type'] == 'context') {
12
    if (strpos($argument['context'], '.')) {
13
      list($context, $converter) = explode('.', $argument['context'], 2);
14
    }
15
    else {
16
      // Backwards-compat for before we had a system for delimiting the data
17
      // we retrieve out of context objects.
18
      $context = $argument['context'];
19
    }
20
    if ($context == 'term' || $context == 'vocabulary') {
21
      $context = 'entity:taxonomy_' . $context;
22
    }
23
    elseif ($entity = entity_get_info($context)) {
24
      $context = 'entity:' . $context;
25
    }
26
    $class = 'ctools_context_' . (empty($argument['context_optional']) ? 'required' : 'optional');
27
    $new_context = new $class($argument['label'], $context);
28
    return $new_context;
29
  }
30
}