function page_manager_term_view_menu_alter

Callback defined by page_manager_term_view_page_manager_tasks().

Alter the term view input so that term view comes to us rather than the normal term view process.

1 string reference to 'page_manager_term_view_menu_alter'
page_manager_term_view_page_manager_tasks in page_manager/plugins/tasks/term_view.inc
Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for more information.

File

page_manager/plugins/tasks/term_view.inc, line 69

Code

function page_manager_term_view_menu_alter(&$items, $task) {
    if (variable_get('page_manager_term_view_disabled', TRUE)) {
        return;
    }
    // Override the term view handler for our purpose, but only if someone else
    // has not already done so.
    if (isset($items['taxonomy/term/%taxonomy_term']) && $items['taxonomy/term/%taxonomy_term']['page callback'] == 'taxonomy_term_page' || variable_get('page_manager_override_anyway', FALSE)) {
        $items['taxonomy/term/%taxonomy_term']['page callback'] = 'page_manager_term_view_page';
        $items['taxonomy/term/%taxonomy_term']['file path'] = $task['path'];
        $items['taxonomy/term/%taxonomy_term']['file'] = $task['file'];
    }
    else {
        // Automatically disable this task if it cannot be enabled.
        variable_set('page_manager_term_view_disabled', TRUE);
        if (isset($items['taxonomy/term/%taxonomy_term']['page callback'])) {
            $callback = $items['taxonomy/term/%taxonomy_term']['page callback'];
        }
        elseif (isset($items['taxonomy/term/%views_arg']['page callback'])) {
            $callback = $items['taxonomy/term/%views_arg']['page callback'];
        }
        else {
            $callback = t('an unknown callback');
        }
        if (!empty($GLOBALS['page_manager_enabling_term_view'])) {
            drupal_set_message(t('Page manager module is unable to enable taxonomy/term/%taxonomy_term because some other module already has overridden with %callback.', array(
                '%callback' => $callback,
            )), 'error');
        }
    }
}