You are here

function group_group_view_menu_alter in Group 7

Tries to hi-jack the group/%group path.

See also

group_group_view_page_manager_tasks()

hook_menu_alter()

1 string reference to 'group_group_view_menu_alter'
group_group_view_page_manager_tasks in plugins/page_manager/tasks/group_view.inc
Implements hook_PLUGIN_page_manager_tasks().

File

plugins/page_manager/tasks/group_view.inc, line 32
Take over group/%group with Page Manager.

Code

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

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

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