[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/panels/includes/ -> page-wizard.inc (source)

   1  <?php
   2  // $Id: page-wizard.inc,v 1.1.2.1 2010/08/30 22:08:57 merlinofchaos Exp $
   3  
   4  /**
   5   * @file
   6   * Contains helper functions for the Panels page wizards.
   7   */
   8  function panels_page_wizard_add_layout(&$form, &$form_state) {
   9    $form_state['allowed_layouts'] = 'panels_page';
  10    $form_state['display'] = $form_state['cache']->display;
  11  
  12    // Tell the Panels form not to display buttons.
  13    $form_state['no buttons'] = TRUE;
  14  
  15    // Change the #id of the form so the CSS applies properly.
  16    $form['#id'] = 'panels-choose-layout';
  17  
  18    $form['layout_prefix'] = array(
  19      '#value' => '<fieldset><legend>' . t('Layout') . '</legend>',
  20    );
  21  
  22    ctools_include('common', 'panels');
  23    ctools_include('display-layout', 'panels');
  24    ctools_include('plugins', 'panels');
  25  
  26    $form = array_merge($form, panels_choose_layout($form_state));
  27  
  28    $form['layout_suffix'] = array(
  29      '#value' => '</fieldset>',
  30    );
  31  }
  32  
  33  function panels_page_wizard_add_content(&$form, &$form_state) {
  34    ctools_include('ajax');
  35    ctools_include('plugins', 'panels');
  36    ctools_include('common', 'panels');
  37    ctools_include('display-edit', 'panels');
  38  
  39    // Panels provides this caching mechanism to make it easy to use the
  40    // wizard to cache the display.
  41  
  42    $cache = panels_edit_cache_get('panels_page_wizard:node_override');
  43  
  44    $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
  45    $form_state['renderer']->cache = &$cache;
  46  
  47    $form_state['display'] = &$cache->display;
  48    $form_state['content_types'] = $cache->content_types;
  49    // Tell the Panels form not to display buttons.
  50    $form_state['no buttons'] = TRUE;
  51    $form_state['display_title'] = !empty($cache->display_title);
  52  
  53    $form = array_merge($form, panels_edit_display_form($form_state));
  54    // Make sure the theme will work since our form id is different.
  55    $form['#theme'] = 'panels_edit_display_form';
  56  }
  57  
  58  function panels_page_wizard_add_content_submit(&$form, &$form_state) {
  59    // Call the normal panels edit form submit to make sure values are stored
  60    // on the display
  61    panels_edit_display_form_submit($form, $form_state);
  62    $cache = &$form_state['cache'];
  63  
  64    // Copy the "being edited" cached display to the "actual" cached display.
  65    $cache->display = &$form_state['display'];
  66    unset($cache->display_cache);
  67  }
  68  


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7