function page_manager_compare_task_handlers

Compare a single task handler from two lists and provide the correct one.

Task handlers can be gotten from multiple sources. As exportable objects, they can be provided by default hooks and the database. But also, because they are tightly bound to tasks, they can also be provided by default tasks. This function reconciles where to pick up a task handler between the exportables list and the defaults provided by the task itself.

Parameters

$result: A list of handlers provided by export.inc

$handlers: A list of handlers provided by the default task.

$name: Which handler to compare.

Return value

Which handler to use, if any. May be NULL.

2 calls to page_manager_compare_task_handlers()
page_manager_load_task_handler in page_manager/page_manager.module
Load a single task handler by name.
page_manager_load_task_handlers in page_manager/page_manager.module
Load all task handlers for a given task/subtask.

File

page_manager/page_manager.module, line 609

Code

function page_manager_compare_task_handlers($result, $handlers, $name) {
    // Compare our special default handler against the actual result, if
    // any, and do the right thing.
    if (!isset($result[$name]) && isset($handlers[$name])) {
        $handlers[$name]->type = t('Default');
        $handlers[$name]->export_type = EXPORT_IN_CODE;
        return $handlers[$name];
    }
    elseif (isset($result[$name]) && !isset($handlers[$name])) {
        return $result[$name];
    }
    elseif (isset($result[$name]) && isset($handlers[$name])) {
        if ($result[$name]->export_type & EXPORT_IN_DATABASE) {
            $result[$name]->type = t('Overridden');
            $result[$name]->export_type = $result[$name]->export_type | EXPORT_IN_CODE;
            return $result[$name];
        }
        else {
            // In this case, our default is a higher priority than the standard default.
            $handlers[$name]->type = t('Default');
            $handlers[$name]->export_type = EXPORT_IN_CODE;
            return $handlers[$name];
        }
    }
}