function modal_term_view_page in Modal operations 7
Page callback - modal: view taxonomy term.
1 string reference to 'modal_term_view_page'
- modal_term_view_menu in modal_term_view/
modal_term_view.module - Implements hook_menu().
File
- modal_term_view/
modal_term_view.module, line 35 - Allows taxonomy term viewing in modal window.
Code
function modal_term_view_page($term, $js) {
// Fall back if $js is not set.
if (!$js) {
$parameters = drupal_get_query_parameters();
unset($_GET['destination']);
drupal_goto('taxonomy/term/' . $term->tid, array(
'query' => $parameters,
));
return NULL;
}
// Fix superglobals (such as $_GET) in order to make arg() work properly.
modal_set_path_data('taxonomy/term/' . $term->tid);
ctools_include('modal');
ctools_include('ajax');
if (!user_access('access content')) {
$commands = array(
ctools_modal_command_display(t('Access denied'), t('You are not authorized to access this page.')),
);
$commands[] = ajax_command_invoke('#modalContent', 'addClass', array(
'modal-denied-term modal-denied-term-' . $term->vocabulary_machine_name,
));
drupal_alter('modal_term_view_access_denied', $commands, $term);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}
$title = check_plain($term->name);
drupal_alter('modal_term_view_title', $title, $term);
$view_mode = 'full';
drupal_alter('modal_term_view_mode', $view_mode, $term);
$term_view = taxonomy_term_view($term, $view_mode);
$commands = array();
$commands[] = ajax_command_invoke('#modalContent', 'addClass', array(
'modal-term modal-term-' . $term->vocabulary_machine_name,
));
drupal_alter('modal_term_view', $commands, $term_view, $term);
array_unshift($commands, ctools_modal_command_display($title, $term_view));
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}