home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (page-wizard.inc)

This example Drupal source code file (page-wizard.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, array_merge, buttons, cache, fieldset, form, form_state, function, panels, panels_edit_display_form, php, theme, true, value

The page-wizard.inc Drupal example source code

// $Id: page-wizard.inc,v 2010/08/30 22:08:57 merlinofchaos Exp $

 * @file
 * Contains helper functions for the Panels page wizards.
function panels_page_wizard_add_layout(&$form, &$form_state) {
  $form_state['allowed_layouts'] = 'panels_page';
  $form_state['display'] = $form_state['cache']->display;

  // Tell the Panels form not to display buttons.
  $form_state['no buttons'] = TRUE;

  // Change the #id of the form so the CSS applies properly.
  $form['#id'] = 'panels-choose-layout';

  $form['layout_prefix'] = array(
    '#value' => '<fieldset><legend>' . t('Layout') . '</legend>',

  ctools_include('common', 'panels');
  ctools_include('display-layout', 'panels');
  ctools_include('plugins', 'panels');

  $form = array_merge($form, panels_choose_layout($form_state));

  $form['layout_suffix'] = array(
    '#value' => '</fieldset>',

function panels_page_wizard_add_content(&$form, &$form_state) {
  ctools_include('plugins', 'panels');
  ctools_include('common', 'panels');
  ctools_include('display-edit', 'panels');

  // Panels provides this caching mechanism to make it easy to use the
  // wizard to cache the display.

  $cache = panels_edit_cache_get('panels_page_wizard:node_override');

  $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
  $form_state['renderer']->cache = &$cache;

  $form_state['display'] = &$cache->display;
  $form_state['content_types'] = $cache->content_types;
  // Tell the Panels form not to display buttons.
  $form_state['no buttons'] = TRUE;
  $form_state['display_title'] = !empty($cache->display_title);

  $form = array_merge($form, panels_edit_display_form($form_state));
  // Make sure the theme will work since our form id is different.
  $form['#theme'] = 'panels_edit_display_form';

function panels_page_wizard_add_content_submit(&$form, &$form_state) {
  // Call the normal panels edit form submit to make sure values are stored
  // on the display
  panels_edit_display_form_submit($form, $form_state);
  $cache = &$form_state['cache'];

  // Copy the "being edited" cached display to the "actual" cached display.
  $cache->display = &$form_state['display'];

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal page-wizard.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.