function file_entity_file_view_menu_alter in File Entity (fieldable files) 7.3
Same name and namespace in other branches
- 7.2 plugins/tasks/file_view.inc \file_entity_file_view_menu_alter()
Callback defined by page_manager_file_view_page_manager_tasks().
Alter the file view input so that file view comes to us rather than the normal file view process.
1 string reference to 'file_entity_file_view_menu_alter'
- file_entity_file_view_page_manager_tasks in plugins/
tasks/ file_view.inc - Specialized implementation of hook_page_manager_task_tasks().
File
- plugins/
tasks/ file_view.inc, line 47 - Handle the 'file view' override task.
Code
function file_entity_file_view_menu_alter(&$items, $task) {
if (variable_get('file_entity_file_view_disabled', TRUE)) {
return;
}
// Override the node view handler for our purpose.
$callback = $items['file/%file']['page callback'];
if ($callback == 'file_entity_view_page' || variable_get('page_manager_override_anyway', FALSE)) {
$items['file/%file']['page callback'] = 'file_entity_file_view_page';
$items['file/%file']['file path'] = $task['path'];
$items['file/%file']['file'] = $task['file'];
}
else {
// automatically disable this task if it cannot be enabled.
variable_set('file_entity_file_view_disabled', TRUE);
if (!empty($GLOBALS['page_manager_enabling_file_view'])) {
drupal_set_message(t('Page manager module is unable to enable file/%file because some other module already has overridden with %callback.', array(
'%callback' => $callback,
)), 'error');
}
}
}