You are here

function ctools_export_ui_get_handler in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 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.

8 calls to ctools_export_ui_get_handler()
ctools_cache_export_ui_cache_get in plugins/cache/export_ui.inc
ctools_cache_export_ui_cache_set in plugins/cache/export_ui.inc
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_load in ./ctools.module
Menu _load hook.

... See full list

File

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

Code

function ctools_export_ui_get_handler($plugin) {
  $cache =& drupal_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;
}