You are here

function page_manager_user_view_page in Chaos Tool Suite (ctools) 7

Entry point for our overridden user view.

This function asks its assigned handlers who, if anyone, would like to run with it. If no one does, it passes through to Drupal core's user view, which is user_page_view().

1 string reference to 'page_manager_user_view_page'
page_manager_user_view_menu_alter in page_manager/plugins/tasks/user_view.inc
Callback defined by page_manager_user_view_page_manager_tasks().

File

page_manager/plugins/tasks/user_view.inc, line 71
Overrides the user profile display at user/%user.

Code

function page_manager_user_view_page($account) {

  // Load my task plugin:
  $task = page_manager_get_task('user_view');

  // Load the account into a context.
  ctools_include('context');
  ctools_include('context-task-handler');
  $contexts = ctools_context_handler_get_task_contexts($task, '', array(
    $account,
  ));

  // Build content. @todo -- this may not be right.
  user_build_content($account);
  $output = ctools_context_handler_render($task, '', $contexts, array(
    $account->uid,
  ));
  if ($output !== FALSE) {
    return $output;
  }
  $function = 'user_view';
  foreach (module_implements('page_manager_override') as $module) {
    $call = $module . '_page_manager_override';
    if (($rc = $call('user_view')) && function_exists($rc)) {
      $function = $rc;
      break;
    }
  }

  // Otherwise, fall back.
  if ($function == 'user_view') {
    module_load_include('inc', 'user', 'user.pages');
  }

  // Fire off "view" op so that triggers still work.
  // @todo -- this doesn't work anymore, and the alternatives seem bad.
  // will have to figure out how to fix this.
  return $function($account);
}