function ctools_views_get_argument_context

Generate new context classes by argument settings on the view.

2 calls to ctools_views_get_argument_context()
_views_content_get_context_from_display in views_content/views_content.module
Get the child plugin for a view context display.
_views_content_panes_content_type in views_content/plugins/content_types/views_panes.inc

File

includes/views.inc, line 10

Code

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;
    }
}