You are here

function ctools_export_ui_switcher_page in Chaos Tool Suite (ctools) 6

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

Main page callback to manipulate exportables.

This simply loads the object defined in the plugin and hands it off to a method based upon the name of the operation in use. This can easily be used to add more ops.

1 string reference to 'ctools_export_ui_switcher_page'
ctools_export_ui_process in includes/export-ui.inc
Process an export-ui plugin to provide it with defaults.

File

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

Code

function ctools_export_ui_switcher_page($plugin_name, $op) {
  $args = func_get_args();
  $js = !empty($_REQUEST['ctools_ajax']);

  // Load the $plugin information
  $plugin = ctools_get_export_ui($plugin_name);
  $handler = ctools_export_ui_get_handler($plugin);
  if ($handler) {
    $method = $op . '_page';
    if (method_exists($handler, $method)) {

      // replace the first two arguments:
      $args[0] = $js;
      $args[1] = $_POST;
      return call_user_func_array(array(
        $handler,
        $method,
      ), $args);
    }
  }
  else {
    return t('Configuration error. No handler found.');
  }
}