function crm_core_contact_view_menu_alter in CRM Core 8
Same name and namespace in other branches
- 8.2 modules/crm_core_contact/legacy/plugins/tasks/view.inc \crm_core_contact_view_menu_alter()
- 7 modules/crm_core_contact/plugins/tasks/view.inc \crm_core_contact_view_menu_alter()
Callback defined by crm_core_contact_view_page_manager_tasks().
Alter the crm_core_contact view input so that crm_core_contact view comes to us rather than the normal crm_core_contact view process.
1 string reference to 'crm_core_contact_view_menu_alter'
- crm_core_contact_view_page_manager_tasks in modules/
crm_core_contact/ legacy/ plugins/ tasks/ view.inc - Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for more information.
File
- modules/
crm_core_contact/ legacy/ plugins/ tasks/ view.inc, line 54 - Handle the 'crm_core_contact view' override task.
Code
function crm_core_contact_view_menu_alter(&$items, $task) {
if (variable_get('page_manager_crm_core_contact_view_disabled', TRUE)) {
return;
}
// Override the crm_core_contact view handler for our purpose.
$callback = $items['crm-core/contact/%crm_core_contact']['page callback'];
if ($callback == 'crm_core_contact_view' || variable_get('page_manager_override_anyway', FALSE)) {
$items['crm-core/contact/%crm_core_contact']['page callback'] = 'crm_core_contact_view_page';
$items['crm-core/contact/%crm_core_contact']['file path'] = $task['path'];
$items['crm-core/contact/%crm_core_contact']['file'] = $task['file'];
}
else {
// Automatically disable this task if it cannot be enabled.
variable_set('page_manager_crm_core_contact_view_disabled', TRUE);
if (!empty($GLOBALS['page_manager_enabling_crm_core_contact_view'])) {
drupal_set_message(t('Page manager module is unable to enable crm-core/contact/%crm_core_contact because some other module already has overridden with %callback.', [
'%callback' => $callback,
]), 'error');
}
}
// @todo override crm_core_contact revision handler as well?
}