You are here

function panels_nid_context in Panels 5.2

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

Discover if this argument gives us the node we crave.

1 string reference to 'panels_nid_context'
panels_nid_panels_arguments in arguments/nid.inc
@file arguments/nid.inc

File

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

Code

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

  // If unset it wants a generic, unfilled context.
  if ($empty) {
    return panels_context_create_empty('node', $conf);
  }
  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;
  }
  return panels_context_create('node', $node, $conf);
}