diff options
Diffstat (limited to 'sites/all/modules/ctools/includes/views.inc')
-rw-r--r-- | sites/all/modules/ctools/includes/views.inc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sites/all/modules/ctools/includes/views.inc b/sites/all/modules/ctools/includes/views.inc new file mode 100644 index 000000000..4ef6439e7 --- /dev/null +++ b/sites/all/modules/ctools/includes/views.inc @@ -0,0 +1,26 @@ +<?php + +/** + * Generate new context classes by argument settings on the view. + */ +function ctools_views_get_argument_context($argument) { + if ($argument['type'] == 'context') { + if (strpos($argument['context'], '.')) { + list($context, $converter) = explode('.', $argument['context'], 2); + } + else { + // Backwards-compat for before we had a system for delimiting the data + // we retrieve out of context objects. + $context = $argument['context']; + } + if ($context == 'term' || $context == 'vocabulary') { + $context = 'entity:taxonomy_' . $context; + } + elseif ($entity = entity_get_info($context)) { + $context = 'entity:' . $context; + } + $class = 'ctools_context_' . (empty($argument['context_optional']) ? 'required' : 'optional'); + $new_context = new $class($argument['label'], $context); + return $new_context; + } +} |