You are here

function page_manager_new_task_handler in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/page_manager.module \page_manager_new_task_handler()

Create a new task handler object.

Parameters

$plugin: The plugin this task handler is created from.

2 calls to page_manager_new_task_handler()
page_manager_handler_add_submit in page_manager/page_manager.admin.inc
Handler related forms.
page_manager_page_form_basic_submit in page_manager/plugins/tasks/page.admin.inc
Store the values from the basic settings form.

File

page_manager/page_manager.module, line 775
The page manager module provides a UI and API to manage pages.

Code

function page_manager_new_task_handler($plugin) {

  // Generate a unique name. Unlike most named objects, we don't let people choose
  // names for task handlers because they mostly don't make sense.
  // Create a new, empty handler object.
  $handler = new stdClass();
  $handler->title = $plugin['title'];
  $handler->task = NULL;
  $handler->subtask = NULL;
  $handler->name = NULL;
  $handler->handler = $plugin['name'];
  $handler->weight = 0;
  $handler->conf = array();

  // These are provided by the core export API provided by ctools and we
  // set defaults here so that we don't cause notices. Perhaps ctools should
  // provide a way to do this for us so we don't have to muck with it.
  $handler->export_type = EXPORT_IN_DATABASE;
  $handler->type = t('Local');
  if (isset($plugin['default conf'])) {
    if (is_array($plugin['default conf'])) {
      $handler->conf = $plugin['default conf'];
    }
    elseif (function_exists($plugin['default conf'])) {
      $handler->conf = $plugin['default conf']($handler);
    }
  }
  return $handler;
}