You are here

function panelizer_edit_node_context_page in Panelizer 6

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

Page to edit basic settings on a panelized node.

1 string reference to 'panelizer_edit_node_context_page'
panelizer_menu in ./panelizer.module
Implementation of hook_menu().

File

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

Code

function panelizer_edit_node_context_page($node) {
  $cache_key = $node->nid;
  $panelizer = panelizer_context_cache_get('node', $cache_key);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  _panelizer_check_admin_theme();
  $form_state = array(
    'panelizer' => &$panelizer,
    'panelizer type' => 'node',
    'panelizer id' => 'node',
    'cache key' => $cache_key,
    'no_redirect' => TRUE,
  );
  ctools_include('form');
  ctools_include('common', 'panelizer');
  $output = ctools_build_form('panelizer_default_context_form', $form_state);
  if (!empty($form_state['executed'])) {
    if (!empty($form_state['clicked_button']['#write'])) {
      drupal_set_message(t('The settings have been updated.'));
      panelizer_save_node_panelizer($panelizer);
    }
    else {
      drupal_set_message(t('Changes have been discarded.'));
    }
    panelizer_context_cache_clear('node', $cache_key);
    drupal_goto($_GET['q']);
  }
  return $output;
}