function panels_context_create_node_edit_form in Panels 5.2
Same name and namespace in other branches
- 6.2 contexts/node_edit_form.inc \panels_context_create_node_edit_form()
It's important to remember that $conf is optional here, because contexts are not always created from the UI.
1 string reference to 'panels_context_create_node_edit_form'
- panels_node_edit_form_panels_contexts in contexts/
node_edit_form.inc - @file contexts/node_edit_form.inc
File
- contexts/
node_edit_form.inc, line 27 - contexts/node_edit_form.inc
Code
function panels_context_create_node_edit_form($empty, $node = NULL, $conf = FALSE) {
$context = new panels_context(array(
'form',
'node_edit',
'node_form',
'node',
));
$context->plugin = 'node_edit_form';
if ($empty) {
return $context;
}
if ($conf) {
// In this case, $node is actually our $conf array.
$node = node_load($node['nid']);
}
if (!empty($node) && node_access('update', $node)) {
// This is from node_edit_page cause Drupal still doesn't use fapi right.
if ($_POST['op'] == t('Delete')) {
// Note: we redirect from node/nid/edit to node/nid/delete to make the tabs disappear.
if ($_REQUEST['destination']) {
$destination = drupal_get_destination();
unset($_REQUEST['destination']);
}
drupal_goto('node/' . $node->nid . '/delete', $destination);
}
$form = drupal_retrieve_form($node->type . '_node_form', $node);
drupal_process_form($node->type . '_node_form', $form);
// Fill in the 'node' portion of the context
$context->data = $node;
$context->title = $node->title;
$context->argument = $node->nid;
$context->form = $form;
$context->form_id = $node->type . '_node_form';
$context->form_title = $node->title;
$context->node_type = $node->type;
return $context;
}
}