function page_manager_user_edit_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 edit, which is drupal_get_form('user_profile_form',$account).
1 string reference to 'page_manager_user_edit_page'
- page_manager_user_edit_menu_alter in page_manager/
plugins/ tasks/ user_edit.inc - Callback defined by page_manager_user_view_page_manager_tasks().
File
- page_manager/
plugins/ tasks/ user_edit.inc, line 83 - Overrides the user profile display at user/%user.
Code
function page_manager_user_edit_page($account, $category = 'account') {
// Store the category on the user for later usage.
$account->user_category = $category;
// Load my task plugin:
$task = page_manager_get_task('user_edit');
// 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 (is_array($output)) {
$output = drupal_render($output);
}
if ($output !== FALSE) {
return $output;
}
$function = 'drupal_get_form';
foreach (module_implements('page_manager_override') as $module) {
$call = $module . '_page_manager_override';
if (($rc = $call('user_edit')) && function_exists($rc)) {
$function = $rc;
break;
}
}
// Otherwise, fall back.
if ($function == 'drupal_get_form') {
// In order to ajax fields to work we need to run form_load_include.
// Hence we eschew drupal_get_form and manually build the info and
// call drupal_build_form.
$form_state = array();
$form_id = 'user_profile_form';
$args = array(
$account,
$category,
);
$form_state['build_info']['args'] = $args;
form_load_include($form_state, 'inc', 'user', 'user.pages');
$output = drupal_build_form($form_id, $form_state);
return $output;
}
// 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);
}