You are here

function page_manager_contact_user_menu_alter in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/plugins/tasks/contact_user.inc \page_manager_contact_user_menu_alter()

Callback defined by page_manager_contact_user_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_contact_user_menu_alter'
page_manager_contact_user_page_manager_tasks in page_manager/plugins/tasks/contact_user.inc
Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for more information.

File

page_manager/plugins/tasks/contact_user.inc, line 47

Code

function page_manager_contact_user_menu_alter(&$items, $task) {
  if (variable_get('page_manager_contact_user_disabled', TRUE)) {
    return;
  }
  $callback = $items['user/%user/contact']['page callback'];
  if ($callback == 'drupal_get_form') {
    $callback = $items['user/%user/contact']['page arguments'][0];
  }

  // Override the user view handler for our purpose.
  if ($callback == 'contact_personal_form' || variable_get('page_manager_override_anyway', FALSE)) {
    $items['user/%user/contact']['page callback'] = 'page_manager_contact_user';
    $items['user/%user/contact']['file path'] = $task['path'];
    $items['user/%user/contact']['file'] = $task['file'];
  }
  else {

    // Automatically disable this task if it cannot be enabled.
    variable_set('page_manager_contact_user_disabled', TRUE);
    if (!empty($GLOBALS['page_manager_enabling_contact_user'])) {
      drupal_set_message(t('Page manager module is unable to enable user/%user/contact because some other module already has overridden with %callback.', array(
        '%callback' => $callback,
      )), 'error');
    }
  }
}