You are here

function panels_node_edit_context in Panels 5.2

Same name and namespace in other branches
  1. 6.2 arguments/node_edit.inc \panels_node_edit_context()

Discover if this argument gives us the node we crave.

1 string reference to 'panels_node_edit_context'
panels_node_edit_panels_arguments in arguments/node_edit.inc
@file arguments/nid.inc

File

arguments/node_edit.inc, line 27
arguments/nid.inc

Code

function panels_node_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) {

  // If unset it wants a generic, unfilled context.
  if ($empty) {
    return panels_context_create_empty('node_edit_form');
  }
  if (!is_numeric($arg)) {
    return FALSE;
  }
  $node = node_load($arg);
  if (!$node) {
    return FALSE;
  }
  if (array_filter($conf['types']) && empty($conf['types'][$node->type])) {
    return FALSE;
  }

  // This will perform a node_access check, so we don't have to.
  return panels_context_create('node_edit_form', $node);
}