function page_manager_user_edit_menu_alter

Callback defined by page_manager_user_view_page_manager_tasks().

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

1 string reference to 'page_manager_user_edit_menu_alter'
page_manager_user_edit_page_manager_tasks in page_manager/plugins/tasks/user_edit.inc
@file Overrides the user profile display at user/%user.

File

page_manager/plugins/tasks/user_edit.inc, line 44

Code

function page_manager_user_edit_menu_alter(&$items, $task) {
    if (variable_get('page_manager_user_edit_disabled', TRUE)) {
        return;
    }
    // Override the user view handler for our purpose.
    if ($items['user/%user/edit']['page callback'] == 'drupal_get_form' || variable_get('page_manager_override_anyway', FALSE)) {
        $items['user/%user/edit']['page callback'] = 'page_manager_user_edit_page';
        $items['user/%user/edit']['page arguments'] = array(
            1,
        );
        $items['user/%user/edit']['file path'] = $task['path'];
        $items['user/%user/edit']['file'] = $task['file'];
        if (($categories = _user_categories()) && count($categories) > 1) {
            foreach ($categories as $key => $category) {
                // 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK.
                if ($category['name'] != 'account') {
                    $items['user/%user_category/edit/' . $category['name']]['page callback'] = 'page_manager_user_edit_page';
                    $items['user/%user_category/edit/' . $category['name']]['page arguments'] = array(
                        1,
                        3,
                    );
                    $items['user/%user_category/edit/' . $category['name']]['file path'] = $task['path'];
                    $items['user/%user_category/edit/' . $category['name']]['file'] = $task['file'];
                }
            }
        }
    }
    else {
        // Automatically disable this task if it cannot be enabled.
        variable_set('page_manager_user_edit_disabled', TRUE);
        if (!empty($GLOBALS['page_manager_enabling_user_edit'])) {
            drupal_set_message(t('Page manager module is unable to enable user/%user/edit because some other module already has overridden with %callback.', array(
                '%callback' => $items['user/%user']['page callback'],
            )), 'error');
        }
    }
}