Projet

Général

Profil

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

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

1
<?php
2

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