You are here

function page_manager_export_task_handler_load in Chaos Tool Suite (ctools) 7

Loads page manager handler for export.

Callback to load page manager handler within ctools_export_crud_load().

Parameters

string $name: The name of the handler to load.

Return value

Loaded page manager handler object, extended with external properties.

1 string reference to 'page_manager_export_task_handler_load'
page_manager_schema_1 in page_manager/page_manager.install
Schema version 1 for Panels in D6.

File

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

Code

function page_manager_export_task_handler_load($name) {
  $table = 'page_manager_handlers';
  $schema = ctools_export_get_schema($table);
  $export = $schema['export'];
  $result = ctools_export_load_object($table, 'names', array(
    $name,
  ));
  if (isset($result[$name])) {
    $handler = $result[$name];

    // Weight is stored in additional table so that in-code task handlers
    // don't need to get written to the database just because they have their
    // weight changed. Therefore, handler could have no correspondent database
    // entry. Revert will not be performed for this handler and the weight
    // will not be reverted. To make possible revert of the weight field
    // export_type must simulate that the handler is stored in the database.
    $handler->export_type = EXPORT_IN_DATABASE;

    // Also, page manager handler weight should be overriden with correspondent
    // weight from page_manager_weights table, if there is one.
    $result = db_query('SELECT weight FROM {page_manager_weights} WHERE name = (:names)', array(
      ':names' => $handler->name,
    ))
      ->fetchField();
    if (is_numeric($result)) {
      $handler->weight = $result;
    }
    return $handler;
  }
}