Projet

Général

Profil

Paste
Télécharger (2,53 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / panels / includes / page-wizard.inc @ 73ab1d0a

1 85ad3d82 Assos Assos
<?php
2
3
/**
4
 * @file
5
 * Contains helper functions for the Panels page wizards.
6
 */
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
 */
14
function panels_page_wizard_add_layout(&$form, &$form_state) {
15
  $form_state['allowed_layouts'] = 'panels_page';
16
  $form_state['display'] = $form_state['wizard cache']->display;
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
32
  $form = panels_choose_layout($form, $form_state);
33
34
  $form['layout_suffix'] = array(
35
    '#value' => '</fieldset>',
36
  );
37
38 64156087 Assos Assos
  // $form_state['cache'] = FALSE;.
39 85ad3d82 Assos Assos
}
40
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
 */
47
function 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
  $cache = panels_edit_cache_get('panels_page_wizard:' . $form_state['plugin']['name']);
56
57
  $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display);
58
  $form_state['renderer']->cache = &$cache;
59
60
  $form_state['display'] = &$cache->display;
61
  $form_state['content_types'] = $cache->content_types;
62
  // Tell the Panels form not to display buttons.
63
  $form_state['no buttons'] = TRUE;
64
  $form_state['display_title'] = !empty($cache->display_title);
65
66
  $form = panels_edit_display_form($form, $form_state);
67
}
68
69
/**
70 64156087 Assos Assos
 * Add content form submit handler.
71 85ad3d82 Assos Assos
 *
72
 * This is not a proper submit handler, it is meant to be called by a form's
73
 * submit handler to handle submission.
74
 */
75
function panels_page_wizard_add_content_submit(&$form, &$form_state) {
76
  // Call the normal panels edit form submit to make sure values are stored
77 64156087 Assos Assos
  // on the display.
78 85ad3d82 Assos Assos
  panels_edit_display_form_submit($form, $form_state);
79
  $cache = &$form_state['wizard cache'];
80
81
  // Copy the "being edited" cached display to the "actual" cached display.
82
  $cache->display = &$form_state['display'];
83
  unset($cache->display_cache);
84
}