You are here

function party_view_page_manager_menu_alter in Party 7

Same name and namespace in other branches
  1. 8.2 plugins/tasks/party_view.inc \party_view_page_manager_menu_alter()

Alter the menu to put us in charge of party_view

1 string reference to 'party_view_page_manager_menu_alter'
party_party_view_page_manager_tasks in plugins/tasks/party_view.inc
Implements hook_page_manager_task_tasks()

File

plugins/tasks/party_view.inc, line 42
Handle the 'party view' overrride task

Code

function party_view_page_manager_menu_alter(&$items, $task) {
  if (variable_get('party_view_page_manager_disabled', TRUE)) {
    return;
  }

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

    // Automatically disable
    variable_set('party_view_page_manager_disabled', TRUE);
    drupal_set_message(t('Page manager module is unable to enable party/%party/party/view because some other module already has overridden with %callback.', array(
      '%callback' => $callback,
    )), 'error');
  }
}