Skip to content

Instantly share code, notes, and snippets.

@dsnopek
Created May 6, 2014 21:54
Show Gist options
  • Save dsnopek/4de040f197087f5fbe47 to your computer and use it in GitHub Desktop.
Save dsnopek/4de040f197087f5fbe47 to your computer and use it in GitHub Desktop.
Shows how to modify the Panels display on a node.
$nid = 123;
$node = node_load($nid);
$display =& $node->panelizer['page_manager']->display;
foreach ($display->content as $pid => $pane) {
if ($pane->uuid == 'd195a038-1e7d-45e7-9232-22e4c6f4da3e') {
$display->content[$pid]->configuration['path'] = 'blerg';
}
}
// This will trigger Panelizer to clone the default and create a custom Panel if one
// doesn't already exist.
$node->panelizer['page_manager']->display_is_modifed = TRUE;
// When this is already a custom panel, we need to save the Panel ourselves.
if ($node->panelizer['page_manager']->did) {
panels_save_display($display);
}
node_save($node);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment