function modal_node_edit_page_edit in Modal operations 7
Page callback - modal: edit node.
1 string reference to 'modal_node_edit_page_edit'
- modal_node_edit_menu in modal_node_edit/
modal_node_edit.module - Implements hook_menu().
File
- modal_node_edit/
modal_node_edit.module, line 124 - Allows node editing, adding and deleting in modal window.
Code
function modal_node_edit_page_edit($node, $js, $force_page_reload = TRUE) {
// Fall back if $js is not set.
if (!$js) {
$parameters = drupal_get_query_parameters();
unset($_GET['destination']);
drupal_goto('node/' . $node->nid . '/edit', array(
'query' => $parameters,
));
return NULL;
}
// Fix superglobals (such as $_GET) in order to make arg() work properly.
modal_set_path_data('node/' . $node->nid . '/edit');
ctools_include('modal');
ctools_include('ajax');
if (!node_access('update', $node)) {
$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-node-edit modal-denied-node-edit-' . $node->type,
));
drupal_alter('modal_node_edit_page_edit_access_denied', $commands, $node);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}
$type_name = node_type_get_name($node);
$title = t('<em>Edit @type</em> @title', array(
'@type' => $type_name,
'@title' => $node->title,
));
drupal_alter('modal_node_edit_title', $title, $node);
return modal_node_edit_node_form($node, $title, $force_page_reload);
}