You are here

function panelizer_load_node_panelizer in Panelizer 6

Same name and namespace in other branches
  1. 7 includes/node.inc \panelizer_load_node_panelizer()

Retrieve the panelizer panel associated with a node.

11 calls to panelizer_load_node_panelizer()
panelizer_context_cache_get in ./panelizer.module
Fetch the panelizer object from the object cache.
panelizer_edit_node_callback in ./panelizer.module
Determine if the current user has access to edit panelizer info on a node.
panelizer_edit_node_content_page in includes/node.inc
Page to edit basic settings on a panelized node.
panelizer_edit_node_layout_page in includes/node.inc
Page to edit basic settings on a panelized node.
panelizer_edit_node_settings_page in includes/node.inc
Page to edit basic settings on a panelized node.

... See full list

File

includes/node.inc, line 11
Contains routines specific to handling nodes that are panelized.

Code

function panelizer_load_node_panelizer($node, $default_anyway = FALSE) {
  if (!empty($node) && is_numeric($node)) {
    $node = node_load($node);
  }
  if (!$node) {
    return FALSE;
  }
  if (!panelizer_is_panelized('node', $node->type)) {
    return FALSE;
  }
  $panelizer = db_fetch_object(db_query("SELECT * FROM {panelizer_node} WHERE nid = %d", $node->nid));
  if ($panelizer && !empty($panelizer->did)) {
    ctools_include('export');
    $panelizer = ctools_export_unpack_object('panelizer_node', $panelizer);
    $panelizer->panelizer_type = 'node';
    return $panelizer;
  }

  // TODO: When we implement choice, we would look to see which default is in use.
  $choice = 'default';

  // Is there a default?
  $panelizer = panelizer_load_default('node', $node->type, $choice, $default_anyway);
  if (!$panelizer) {
    return FALSE;
  }
  return panelizer_clone_node_panelizer($panelizer, $node->nid);
}