You are here

function ctools_export_ui_get_handler in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/export-ui.inc \ctools_export_ui_get_handler()

Get the class to handle creating a list of exportable items.

If a plugin does not define a lister class at all, then the default lister class will be used.

Return value

Either the lister class or FALSE if one could not be had.

7 calls to ctools_export_ui_get_handler()
ctools_export_ui_context_cache_get in ./ctools.module
Cache callback on behalf of ctools_export_ui.
ctools_export_ui_context_cache_set in ./ctools.module
Cache callback on behalf of ctools_export_ui.
ctools_export_ui_ctools_access_get in ./ctools.module
Callback for access control ajax form on behalf of export ui.
ctools_export_ui_ctools_access_set in ./ctools.module
Callback for access control ajax form on behalf of export ui
ctools_export_ui_menu in includes/export-ui.menu.inc
Delegated implementation of hook_menu().

... See full list

File

includes/export-ui.inc, line 409
Provide a tool for creating UIs for exportable objects.

Code

function ctools_export_ui_get_handler($plugin) {
  $cache =& ctools_static(__FUNCTION__, array());
  if (empty($cache[$plugin['name']])) {

    // If a list class is not specified by the plugin, fall back to the
    // default ctools_export_ui plugin instead.
    if (empty($plugin['handler'])) {
      $default = ctools_get_export_ui('ctools_export_ui');
      $class = ctools_plugin_get_class($default, 'handler');
    }
    else {
      $class = ctools_plugin_get_class($plugin, 'handler');
    }
    if ($class) {
      $cache[$plugin['name']] = new $class();
      $cache[$plugin['name']]
        ->init($plugin);
    }
  }
  return !empty($cache[$plugin['name']]) ? $cache[$plugin['name']] : FALSE;
}