summaryrefslogtreecommitdiffstats
path: root/ctools_plugin_example/plugins/panels.pages.inc
blob: d3022af7fc194a91224bc7663d7d91e0530f62a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php

/**
 * @file
 * Holds the panels pages export.
 */

/**
 * Implements hook_default_panel_pages()
 */
function ctools_plugin_example_default_panel_pages() {
  $page = new stdClass();
  $page->pid = 'new';
  $page->did = 'new';
  $page->name = 'ctools_plugin_example_demo_panel';
  $page->title = 'Panels Plugin Example Demo Panel';
  $page->access = array();
  $page->path = 'demo_panel';
  $page->load_flags = 1;
  $page->css_id = '';
  $page->arguments = array(
  0 =>
  array(
      'name' => 'simplecontext_arg',
      'id' => 1,
      'default' => '404',
      'title' => '',
      'identifier' => 'Simplecontext arg',
      'keyword' => 'simplecontext',
  ),
  );
  $page->relationships = array(
  0 =>
  array(
      'context' => 'argument_simplecontext_arg_1',
      'name' => 'relcontext_from_simplecontext',
      'id' => 1,
      'identifier' => 'Relcontext from Simplecontext',
      'keyword' => 'relcontext',
  ),
  );
  $page->no_blocks = '0';
  $page->switcher_options = array();
  $page->menu = '0';
  $page->contexts = array();
  $display = new ctools_display();
  $display->did = 'new';
  $display->layout = 'threecol_33_34_33_stacked';
  $display->layout_settings = array();
  $display->panel_settings = array();
  $display->content = array();
  $display->panels = array();
  $pane = new stdClass();
  $pane->pid = 'new-1';
  $pane->panel = 'left';
  $pane->type = 'custom';
  $pane->shown = '1';
  $pane->subtype = 'custom';
  $pane->access = array();
  $pane->configuration = array(
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'title' => '"No Context Item"',
      'body' => 'The "no context item" content type is here to demonstrate that you can create a content_type that does not require a context. This is probably the same as just creating a custom php block on the fly, and might serve the same purpose.',
      'format' => '1',
  );
  $pane->cache = array();
  $display->content['new-1'] = $pane;
  $display->panels['left'][0] = 'new-1';
  $pane = new stdClass();
  $pane->pid = 'new-2';
  $pane->panel = 'left';
  $pane->type = 'no_context_item';
  $pane->shown = '1';
  $pane->subtype = 'description';
  $pane->access = array();
  $pane->configuration = array(
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'item1' => 'one',
      'item2' => 'two',
      'item3' => 'three',
  );
  $pane->cache = array();
  $display->content['new-2'] = $pane;
  $display->panels['left'][1] = 'new-2';
  $pane = new stdClass();
  $pane->pid = 'new-3';
  $pane->panel = 'middle';
  $pane->type = 'custom';
  $pane->shown = '1';
  $pane->subtype = 'custom';
  $pane->access = array();
  $pane->configuration = array(
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'title' => 'Simplecontext',
      'body' => 'The "Simplecontext" content and content type demonstrate a very basic context and how to display it.

    Simplecontext includes configuration, so it can get info from the config. It can also get its information to run from a simplecontext context, generated either from an arg to the panels page or via explicitly adding a context to the page.',
      'format' => '1',
  );
  $pane->cache = array();
  $display->content['new-3'] = $pane;
  $display->panels['middle'][0] = 'new-3';
  $pane = new stdClass();
  $pane->pid = 'new-4';
  $pane->panel = 'middle';
  $pane->type = 'simplecontext_item';
  $pane->shown = '1';
  $pane->subtype = 'description';
  $pane->access = array(
  0 => '2',
  1 => '4',
  );
  $pane->configuration = array(
      'context' => 'argument_simplecontext_arg_1',
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'config_item_1' => 'simplecontext called from arg',
  );
  $pane->cache = array();
  $display->content['new-4'] = $pane;
  $display->panels['middle'][1] = 'new-4';
  $pane = new stdClass();
  $pane->pid = 'new-5';
  $pane->panel = 'right';
  $pane->type = 'custom';
  $pane->shown = '1';
  $pane->subtype = 'custom';
  $pane->access = array();
  $pane->configuration = array(
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'title' => 'Relcontext',
      'body' => 'The relcontext content_type gets its data from a relcontext, which is an example of a relationship. This panel should be run with an argument like "/xxx", which allows the simplecontext to get its context, and then the relcontext is configured in this panel to get (create) its data from the simplecontext.',
      'format' => '1',
  );
  $pane->cache = array();
  $display->content['new-5'] = $pane;
  $display->panels['right'][0] = 'new-5';
  $pane = new stdClass();
  $pane->pid = 'new-6';
  $pane->panel = 'right';
  $pane->type = 'relcontext_item';
  $pane->shown = '1';
  $pane->subtype = 'description';
  $pane->access = array();
  $pane->configuration = array(
      'context' => 'relationship_relcontext_from_simplecontext_1',
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'config_item_1' => 'default1',
  );
  $pane->cache = array();
  $display->content['new-6'] = $pane;
  $display->panels['right'][1] = 'new-6';
  $pane = new stdClass();
  $pane->pid = 'new-7';
  $pane->panel = 'top';
  $pane->type = 'custom_php';
  $pane->shown = '1';
  $pane->subtype = 'custom_php';
  $pane->access = array();
  $pane->configuration = array(
      'style' => 'default',
      'override_title' => 0,
      'override_title_text' => '',
      'css_id' => '',
      'css_class' => '',
      'title' => '',
      'body' => '$arg = arg(1);
    $arg0 = arg(0);
    if (!$arg) {
    $block->content = <<<END
    <em>This page is intended to run with an arg and you don\'t have one.</em>
    <br />
    Without an arg, the page doesn\'t have any context.
    <br />Please try something like "/$arg0/xxx"
END;

    $block->title = "This is intended to run with an argument";
    } else {
    $block->content = "The arg for this page is \'$arg\'";
    }',
  );
  $pane->cache = array();
  $display->content['new-7'] = $pane;
  $display->panels['top'][0] = 'new-7';
  $page->display = $display;
  $page->displays = array();
  $pages['ctools_plugin_example'] = $page;


  return $pages;
}