You are here

function panelizer_default_context_form in Panelizer 7

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

Form to edit contexts that go with a panelizer panel.

2 string references to 'panelizer_default_context_form'
panelizer_default_context_page in includes/admin.inc
Page to configure what content is available for a given node type.
panelizer_edit_node_context_page in includes/node.inc
Page to edit basic settings on a panelized node.

File

includes/common.inc, line 97
Contains common forms and routines that different object types use.

Code

function panelizer_default_context_form($form, &$form_state) {
  ctools_include('context-admin');
  ctools_context_admin_includes();
  $panelizer =& $form_state['panelizer'];
  $panelizer->base_contexts = panelizer_get_base_context($form_state['panelizer id']);
  if (!empty($panelizer->cached)) {
    $form['markup'] = array(
      '#prefix' => '<div class="messages warning">',
      '#markup' => t('This form contains unsaved changes that will not be stored until the Save button is clicked.'),
      '#suffix' => '</div>',
    );
  }
  $form['right'] = array(
    '#prefix' => '<div class="clear-block"><div class="right-container">',
    '#suffix' => '</div>',
  );
  $form['left'] = array(
    '#prefix' => '<div class="left-container">',
    '#suffix' => '</div></div>',
  );
  $module = 'panelizer_context::' . $form_state['panelizer type'];
  ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $panelizer, $form_state['cache key']);
  ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $panelizer, $form_state['cache key']);

  // Set an additional description if CCK and Token are enabled, to notify of unlisted keywords
  if (module_exists('content') && module_exists('token')) {
    $description = t('Note that CCK fields may be used as keywords using patterns like <em>%node:field_name-formatted</em>.');
  }
  elseif (!module_exists('token')) {
    $description = t('More keywords will be available if you install the Token module, see http://drupal.org/project/token.');
  }
  else {
    $description = '';
  }

  // TODO Please change this theme call to use an associative array for the $variables parameter.
  $form['left']['summary'] = array(
    '#prefix' => '<div class="page-manager-contexts">',
    '#suffix' => '</div>',
    '#markup' => theme('ctools_context_list', array(
      'object' => $panelizer,
      'header' => t('Summary of contexts'),
      'description' => $description,
    )),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#write' => TRUE,
  );
  $form['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
  );
  return $form;
}