function _ctools_context_get_converters

Get a list of converters available for a given context.

@internal This function DOES NOT form part of the CTools API. Use the API function ctools_context_get_converters() instead.

Parameters

string $id: A context ID.

string $plugin_name: The name of the context plugin.

Return value

array A list of context converters.

2 calls to _ctools_context_get_converters()
ctools_context_get_all_converters in includes/context.inc
Get a list of all contexts converters available.
ctools_context_get_converters in includes/context.inc
Get a list of converters available for a given context.

File

includes/context.inc, line 805

Code

function _ctools_context_get_converters($id, $plugin_name) {
    $plugin = ctools_get_context($plugin_name);
    if (empty($plugin['convert list'])) {
        return array();
    }
    $converters = array();
    if (is_array($plugin['convert list'])) {
        $converters = $plugin['convert list'];
    }
    elseif ($function = ctools_plugin_get_function($plugin, 'convert list')) {
        $converters = (array) $function($plugin);
    }
    foreach (module_implements('ctools_context_convert_list_alter') as $module) {
        $function = $module . '_ctools_context_convert_list_alter';
        $function($plugin, $converters);
    }
    // Now, change them all to include the plugin:
    $return = array();
    foreach ($converters as $key => $title) {
        $return[$id . $key] = $title;
    }
    natcasesort($return);
    return $return;
}