You are here

function panelizer_default_context_page in Panelizer 7

Same name and namespace in other branches
  1. 6 includes/admin.inc \panelizer_default_context_page()
  2. 7.3 includes/admin.inc \panelizer_default_context_page()
  3. 7.2 includes/admin.inc \panelizer_default_context_page()

Page to configure what content is available for a given node type.

1 string reference to 'panelizer_default_context_page'
panelizer_menu in ./panelizer.module
Implements hook_menu().

File

includes/admin.inc, line 281
Contains administrative forms and settings.

Code

function panelizer_default_context_page($type, $key, $name) {
  $cache_key = $type . ':' . $key . ':' . $name;
  $panelizer = panelizer_context_cache_get('default', $cache_key);
  if (empty($panelizer)) {
    return MENU_NOT_FOUND;
  }
  $form_state = array(
    'panelizer' => &$panelizer,
    'panelizer type' => 'default',
    'panelizer id' => $type,
    'cache key' => $cache_key,
    'no_redirect' => TRUE,
  );
  ctools_include('common', 'panelizer');
  $output = drupal_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.'));
      ctools_include('export');
      ctools_export_crud_save('panelizer_defaults', $panelizer);
    }
    else {
      drupal_set_message(t('Changes have been discarded.'));
    }
    panelizer_context_cache_clear('default', $cache_key);
    drupal_goto($_GET['q']);
  }
  return $output;
}