summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module38
1 files changed, 38 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module
index 6d6c199..62f6d27 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ctools/page_manager/page_manager.module
@@ -696,6 +696,44 @@ function page_manager_export_task_handler($handler, $indent = '') {
}
/**
+ * Loads page manager handler for export.
+ *
+ * Callback to load page manager handler within ctools_export_crud_load().
+ *
+ * @param string $name
+ * The name of the handler to load.
+ *
+ * @return
+ * Loaded page manager handler object, extended with external properties.
+ */
+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;
+ }
+}
+
+/**
* Create a new task handler object.
*
* @param $plugin