function ctools_context_convert_context

Let the context convert an argument based upon the converter that was given.

Parameters

ctools_context $context: The context object.

string $converter: The type of converter to use, which should be a string provided by the converter list function.

array $converter_options: An array of options to pass on to the generation function. For contexts that use token module, of particular use is 'sanitize' => FALSE which can get raw tokens. This should ONLY be used in values that will later be treated as unsafe user input since these values are by themselves unsafe. It is particularly useful to get raw values from Field API.

Return value

string|null

4 calls to ctools_context_convert_context()
ctools_context_keyword_substitute in includes/context.inc
Perform keyword and context substitutions.
views_content_views_content_type_render in views_content/plugins/content_types/views.inc
Output function for the 'views' content type.
views_content_views_panes_content_type_render in views_content/plugins/content_types/views_panes.inc
Output function for the 'views' content type.
views_content_view_from_argument_context in views_content/plugins/relationships/view_from_argument.inc
Return a new context based on an existing context.

File

includes/context.inc, line 875

Code

function ctools_context_convert_context($context, $converter, $converter_options = array()) {
    // Contexts without plugins might be optional placeholders.
    if (empty($context->plugin)) {
        return NULL;
    }
    $value = $context->argument;
    $plugin = ctools_get_context($context->plugin);
    if ($function = ctools_plugin_get_function($plugin, 'convert')) {
        $value = $function($context, $converter, $converter_options);
    }
    foreach (module_implements('ctools_context_converter_alter') as $module) {
        $function = $module . '_ctools_context_converter_alter';
        $function($context, $converter, $value, $converter_options);
    }
    return $value;
}