Remove references to no longer used theme for panels_edit_display_form
[project/panels.git] / includes / page-wizard.inc
CommitLineData
946024d2 1<?php
946024d2
SB
2
3/**
4 * @file
5 * Contains helper functions for the Panels page wizards.
6 */
2f354acb
SB
7
8/**
9 * Add layout form helper for panels page wizards.
10 *
11 * This is not a proper form, it is meant to be called by a form to add
12 * elements to it.
13 */
946024d2
SB
14function panels_page_wizard_add_layout(&$form, &$form_state) {
15 $form_state['allowed_layouts'] = 'panels_page';
2f354acb 16 $form_state['display'] = $form_state['wizard cache']->display;
946024d2
SB
17
18 // Tell the Panels form not to display buttons.
19 $form_state['no buttons'] = TRUE;
20
21 // Change the #id of the form so the CSS applies properly.
22 $form['#id'] = 'panels-choose-layout';
23
24 $form['layout_prefix'] = array(
25 '#value' => '<fieldset><legend>' . t('Layout') . '</legend>',
26 );
27
28 ctools_include('common', 'panels');
29 ctools_include('display-layout', 'panels');
30 ctools_include('plugins', 'panels');
31
2f354acb 32 $form = panels_choose_layout($form, $form_state);
946024d2
SB
33
34 $form['layout_suffix'] = array(
35 '#value' => '</fieldset>',
36 );
2f354acb
SB
37
38// $form_state['cache'] = FALSE;
946024d2
SB
39}
40
2f354acb
SB
41/**
42 * Add content editor form helper for panels page wizards.
43 *
44 * This is not a proper form, it is meant to be called by a form to add
45 * elements to it.
46 */
946024d2
SB
47function panels_page_wizard_add_content(&$form, &$form_state) {
48 ctools_include('ajax');
49 ctools_include('plugins', 'panels');
50 ctools_include('common', 'panels');
51 ctools_include('display-edit', 'panels');
52
53 // Panels provides this caching mechanism to make it easy to use the
54 // wizard to cache the display.
55
2f354acb 56 $cache = panels_edit_cache_get('panels_page_wizard:' . $form_state['plugin']['name']);
946024d2
SB
57
58 $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
59 $form_state['renderer']->cache = &$cache;
60
61 $form_state['display'] = &$cache->display;
62 $form_state['content_types'] = $cache->content_types;
63 // Tell the Panels form not to display buttons.
64 $form_state['no buttons'] = TRUE;
65 $form_state['display_title'] = !empty($cache->display_title);
66
2f354acb 67 $form = panels_edit_display_form($form, $form_state);
946024d2
SB
68}
69
2f354acb
SB
70/**
71 * Add content form submit handler
72 *
73 * This is not a proper submit handler, it is meant to be called by a form's
74 * submit handler to handle submission.
75 */
946024d2
SB
76function panels_page_wizard_add_content_submit(&$form, &$form_state) {
77 // Call the normal panels edit form submit to make sure values are stored
78 // on the display
79 panels_edit_display_form_submit($form, $form_state);
2f354acb 80 $cache = &$form_state['wizard cache'];
946024d2
SB
81
82 // Copy the "being edited" cached display to the "actual" cached display.
83 $cache->display = &$form_state['display'];
84 unset($cache->display_cache);
85}
86