page.inc
23.5 KB
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
<?php
/**
* @file
* Handle the 'page' task, which creates pages with arbitrary tasks and lets
* handlers decide how they will be rendered.
*
* This creates subtasks and stores them in the page_manager_pages table. These
* are exportable objects, too.
*
* The render callback for this task type has $handler, $page, $contexts as
* parameters.
*/
/**
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
* more information.
*/
function page_manager_page_page_manager_tasks() {
return array(
'title' => t('Custom pages'),
'description' => t('Administrator created pages that have a URL path, access control and entries in the Drupal menu system.'),
'non-exportable' => TRUE,
'subtasks' => TRUE,
'subtask callback' => 'page_manager_page_subtask',
'subtasks callback' => 'page_manager_page_subtasks',
'save subtask callback' => 'page_manager_page_save_subtask',
'access callback' => 'page_manager_page_access_check',
'hook menu' => array(
'file' => 'page.admin.inc',
'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
'function' => 'page_manager_page_menu',
),
'hook theme' => 'page_manager_page_theme',
// page only items
'task type' => 'page',
'page operations' => array(
array(
'title' => ' » ' . t('Create a new page'),
'href' => 'admin/structure/pages/add',
'html' => TRUE,
),
),
'columns' => array(
'storage' => array(
'label' => t('Storage'),
'class' => 'page-manager-page-storage',
),
),
'page type' => 'custom',
// context only items
'handler type' => 'context',
'get arguments' => array(
'file' => 'page.admin.inc',
'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
'function' => 'page_manager_page_get_arguments',
),
'get context placeholders' => 'page_manager_page_get_contexts',
'access restrictions' => 'page_manager_page_access_restrictions',
'uses handlers' => TRUE,
);
}
/**
* Task callback to get all subtasks.
*
* Return a list of all subtasks.
*/
function page_manager_page_subtasks($task) {
$pages = page_manager_page_load_all($task['name']);
$return = array();
foreach ($pages as $name => $page) {
$return[$name] = page_manager_page_build_subtask($task, $page);
}
return $return;
}
/**
* Callback to return a single subtask.
*/
function page_manager_page_subtask($task, $subtask_id) {
$page = page_manager_page_load($subtask_id);
if ($page) {
return page_manager_page_build_subtask($task, $page);
}
}
/**
* Call back from the administrative system to save a page.
*
* We get the $subtask as created by page_manager_page_build_subtask.
*/
function page_manager_page_save_subtask($subtask) {
$page = &$subtask['subtask'];
// Ensure $page->arguments contains only real arguments:
$arguments = page_manager_page_get_named_arguments($page->path);
$args = array();
foreach ($arguments as $keyword => $position) {
if (isset($page->arguments[$keyword])) {
$args[$keyword] = $page->arguments[$keyword];
}
else {
$args[$keyword] = array(
'id' => '',
'identifier' => '',
'argument' => '',
'settings' => array(),
);
}
}
page_manager_page_recalculate_arguments($page);
// Create a real object from the cache
page_manager_page_save($page);
// Check to see if we should make this the site frontpage.
if (!empty($page->make_frontpage)) {
$path = array();
foreach (explode('/', $page->path) as $bit) {
if ($bit[0] != '!') {
$path[] = $bit;
}
}
$path = implode('/', $path);
$front = variable_get('site_frontpage', 'node');
if ($path != $front) {
variable_set('site_frontpage', $path);
}
}
}
/**
* Build a subtask array for a given page.
*/
function page_manager_page_build_subtask($task, $page) {
$operations = array();
$operations['settings'] = array(
'type' => 'group',
'class' => array('operations-settings'),
'title' => t('Settings'),
'children' => array(),
);
$settings = &$operations['settings']['children'];
$settings['basic'] = array(
'title' => t('Basic'),
'description' => t('Edit name, path and other basic settings for the page.'),
'form' => 'page_manager_page_form_basic',
);
$arguments = page_manager_page_get_named_arguments($page->path);
if ($arguments) {
$settings['argument'] = array(
'title' => t('Arguments'),
'description' => t('Set up contexts for the arguments on this page.'),
'form' => 'page_manager_page_form_argument',
);
}
$settings['access'] = array(
'title' => t('Access'),
'description' => t('Control what users can access this page.'),
'admin description' => t('Access rules are used to test if the page is accessible and any menu items associated with it are visible.'),
'form' => 'page_manager_page_form_access',
);
$settings['menu'] = array(
'title' => t('Menu'),
'description' => t('Provide this page a visible menu or a menu tab.'),
'form' => 'page_manager_page_form_menu',
);
$operations['actions']['children']['clone'] = array(
'title' => t('Clone'),
'description' => t('Make a copy of this page'),
'form' => 'page_manager_page_form_clone',
);
$operations['actions']['children']['export'] = array(
'title' => t('Export'),
'description' => t('Export this page as code that can be imported or embedded into a module.'),
'form' => 'page_manager_page_form_export',
);
if ($page->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
$operations['actions']['children']['delete'] = array(
'title' => t('Revert'),
'description' => t('Remove all changes to this page and revert to the version in code.'),
'form' => 'page_manager_page_form_delete',
);
}
else if ($page->export_type != EXPORT_IN_CODE) {
$operations['actions']['children']['delete'] = array(
'title' => t('Delete'),
'description' => t('Remove this page from your system completely.'),
'form' => 'page_manager_page_form_delete',
);
}
$subtask = array(
'name' => $page->name,
'admin title' => check_plain($page->admin_title),
'admin description' => filter_xss_admin($page->admin_description),
'admin summary' => 'page_manager_page_admin_summary',
'admin path' => $page->path,
'admin type' => t('Custom'),
'subtask' => $page,
'operations' => $operations,
'operations include' => array(
'file' => 'page.admin.inc',
'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
),
'single task' => empty($page->multiple),
'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled',
'storage' => $page->type == t('Default') ? t('In code') : $page->type,
'disabled' => !empty($page->disabled),
// This works for both enable AND disable
'enable callback' => 'page_manager_page_enable',
);
// default handlers may appear from a default subtask.
if (isset($page->default_handlers)) {
$subtask['default handlers'] = $page->default_handlers;
}
return $subtask;
}
/**
* Delegated implementation of hook_theme().
*/
function page_manager_page_theme(&$items, $task) {
$base = array(
'file' => 'page.admin.inc',
'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
);
$items['page_manager_page_form_argument_table'] = $base + array(
'render element' => 'form',
);
$items['page_manager_page_lock'] = $base + array(
'variables' => array('lock' => array(), 'task_name' => NULL),
);
$items['page_manager_page_changed'] = $base + array(
'variables' => array(),
);
}
// --------------------------------------------------------------------------
// Page execution functions
/**
* Execute a page task.
*
* This is the callback to entries in the Drupal menu system created by the
* page task.
*
* @param $subtask_id
* The name of the page task used.
* @param ...
* A number of context objects as specified by the user when
* creating named arguments in the path.
*/
function page_manager_page_execute($subtask_id) {
$page = page_manager_page_load($subtask_id);
$task = page_manager_get_task($page->task);
$subtask = page_manager_get_task_subtask($task, $subtask_id);
// Turn the contexts into a properly keyed array.
$contexts = array();
$args = array();
foreach (func_get_args() as $count => $arg) {
if (is_object($arg) && get_class($arg) == 'ctools_context') {
$contexts[$arg->id] = $arg;
$args[] = $arg->original_argument;
}
else if ($count) {
$args[] = $arg;
}
}
$count = 0;
$names = page_manager_page_get_named_arguments($page->path);
$bits = explode('/', $page->path);
if ($page->arguments) {
foreach ($page->arguments as $name => $argument) {
// Optional arguments must be converted to contexts too, if they exist.
if ($bits[$names[$name]][0] == '!') {
ctools_include('context');
$argument['keyword'] = $name;
if (isset($args[$count])) {
// Hack: use a special argument config variable to learn if we need
// to use menu_tail style behavior:
if (empty($argument['settings']['use_tail'])) {
$value = $args[$count];
}
else {
$value = implode('/', array_slice($args, $count));
}
$context = ctools_context_get_context_from_argument($argument, $value);
}
else {
// make sure there is a placeholder context for missing optional contexts.
$context = ctools_context_get_context_from_argument($argument, NULL, TRUE);
// Force the title to blank for replacements
}
if ($context) {
$contexts[$context->id] = $context;
}
}
$count++;
}
}
if ($function = ctools_plugin_get_function($task, 'page callback')) {
return call_user_func_array($function, array($page, $contexts, $args));
}
ctools_include('context-task-handler');
$output = ctools_context_handler_render($task, $subtask, $contexts, $args);
if ($output === FALSE) {
return MENU_NOT_FOUND;
}
return $output;
}
// --------------------------------------------------------------------------
// Context type callbacks
/**
* Return a list of arguments used by this task.
*/
function page_manager_page_get_arguments($task, $subtask) {
return _page_manager_page_get_arguments($subtask['subtask']);
}
function _page_manager_page_get_arguments($page) {
$arguments = array();
if (!empty($page->arguments)) {
foreach ($page->arguments as $keyword => $argument) {
if (isset($argument['name'])) {
$argument['keyword'] = $keyword;
$arguments[$keyword] = $argument;
}
}
}
return $arguments;
}
/**
* Get a group of context placeholders for the arguments.
*/
function page_manager_page_get_contexts($task, $subtask) {
ctools_include('context');
return ctools_context_get_placeholders_from_argument(page_manager_page_get_arguments($task, $subtask));
}
/**
* Return a list of arguments used by this task.
*/
function page_manager_page_access_restrictions($task, $subtask, $contexts) {
$page = $subtask['subtask'];
return ctools_access_add_restrictions($page->access, $contexts);
}
// --------------------------------------------------------------------------
// Page task database info.
/**
* Create a new page with defaults appropriately set from schema.
*/
function page_manager_page_new() {
ctools_include('export');
return ctools_export_new_object('page_manager_pages');
}
/**
* Load a single page subtask.
*/
function page_manager_page_load($name) {
ctools_include('export');
$result = ctools_export_load_object('page_manager_pages', 'names', array($name));
if (isset($result[$name])) {
return $result[$name];
}
}
/**
* Load all page subtasks.
*/
function page_manager_page_load_all($task = NULL) {
ctools_include('export');
if (empty($task)) {
return ctools_export_load_object('page_manager_pages');
}
else {
return ctools_export_load_object('page_manager_pages', 'conditions', array('task' => $task));
}
}
/**
* Write a page subtask to the database.
*/
function page_manager_page_save(&$page) {
$update = (isset($page->pid)) ? array('pid') : array();
$task = page_manager_get_task($page->task);
if ($function = ctools_plugin_get_function($task, 'save')) {
$function($page, $update);
}
drupal_write_record('page_manager_pages', $page, $update);
// If this was a default page we may need to write default task
// handlers that we provided as well.
if (!$update && isset($page->default_handlers)) {
$handlers = page_manager_load_task_handlers(page_manager_get_task('page'), $page->name);
foreach ($page->default_handlers as $name => $handler) {
if (!isset($handlers[$name]) || !($handlers[$name]->export_type & EXPORT_IN_DATABASE)) {
// Make sure this is right, as exports can wander a bit.
$handler->subtask = $page->name;
page_manager_save_task_handler($handler);
}
}
}
return $page;
}
/**
* Remove a page subtask.
*/
function page_manager_page_delete($page) {
$task = page_manager_get_task($page->task);
if ($function = ctools_plugin_get_function($task, 'delete')) {
$function($page);
}
if (!empty($task['uses handlers'])) {
$handlers = page_manager_load_task_handlers($task, $page->name);
foreach ($handlers as $handler) {
page_manager_delete_task_handler($handler);
}
}
db_delete('page_manager_pages')
->condition('name', $page->name)
->execute();
// Make sure that the cache is reset so that the menu rebuild does not
// rebuild this page again.
ctools_include('export');
ctools_export_load_object_reset('page_manager_pages');
menu_rebuild();
}
/**
* Export a page subtask.
*/
function page_manager_page_export($page, $with_handlers = FALSE, $indent = '') {
$task = page_manager_get_task($page->task);
$append = '';
if ($function = ctools_plugin_get_function($task, 'export')) {
$append = $function($page, $indent);
}
ctools_include('export');
$output = ctools_export_object('page_manager_pages', $page, $indent);
$output .= $append;
if ($with_handlers) {
if (is_array($with_handlers)) {
$handlers = $with_handlers;
}
else {
$handlers = page_manager_load_task_handlers(page_manager_get_task('page'), $page->name);
}
$output .= $indent . '$page->default_handlers = array();' . "\n";
foreach ($handlers as $handler) {
$output .= page_manager_export_task_handler($handler, $indent);
$output .= $indent . '$page->default_handlers[$handler->name] = $handler;' . "\n";
}
}
return $output;
}
/**
* Get a list of named arguments in a page manager path.
*
* @param $path
* A normal Drupal path.
*
* @return
* An array of % marked variable arguments, keyed by the argument's name.
* The value will be the position of the argument so that it can easily
* be found. Items with a position of -1 have multiple positions.
*/
function page_manager_page_get_named_arguments($path) {
$arguments = array();
$bits = explode('/', $path);
foreach ($bits as $position => $bit) {
if ($bit && ($bit[0] == '%' || $bit[0] == '!')) {
// special handling for duplicate path items and substr to remove the %
$arguments[substr($bit, 1)] = isset($arguments[$bit]) ? -1 : $position;
}
}
return $arguments;
}
/**
* Load a context from an argument for a given page task.
*
* Helper function for pm_arg_load(), which is in page_manager.module because
* drupal's menu system does not allow loader functions to reside in separate
* files.
*
* @param $value
* The incoming argument value.
* @param $subtask
* The subtask id.
* @param $argument
* The numeric position of the argument in the path, counting from 0.
*
* @return
* A context item if one is configured, the argument if one is not, or
* FALSE if restricted or invalid.
*/
function _pm_arg_load($value, $subtask, $argument) {
$page = page_manager_page_load($subtask);
if (!$page) {
return FALSE;
}
$path = explode('/', $page->path);
if (empty($path[$argument])) {
return FALSE;
}
$keyword = substr($path[$argument], 1);
if (empty($page->arguments[$keyword])) {
return $value;
}
$page->arguments[$keyword]['keyword'] = $keyword;
ctools_include('context');
$context = ctools_context_get_context_from_argument($page->arguments[$keyword], $value);
// convert false equivalents to false.
return $context ? $context : FALSE;
}
/**
* Provide a nice administrative summary of the page so an admin can see at a
* glance what this page does and how it is configured.
*/
function page_manager_page_admin_summary($task, $subtask) {
$task_name = page_manager_make_task_name($task['name'], $subtask['name']);
$page = $subtask['subtask'];
$output = '';
$rows = array();
$rows[] = array(
array('class' => array('page-summary-label'), 'data' => t('Storage')),
array('class' => array('page-summary-data'), 'data' => $subtask['storage']),
array('class' => array('page-summary-operation'), 'data' => ''),
);
if (!empty($page->disabled)) {
$link = l(t('Enable'), page_manager_edit_url($task_name, array('handlers', $page->name, 'actions', 'enable')));
$text = t('Disabled');
}
else {
$link = l(t('Disable'), page_manager_edit_url($task_name, array('handlers', $page->name, 'actions', 'disable')));
$text = t('Enabled');
}
$rows[] = array(
array('class' => array('page-summary-label'), 'data' => t('Status')),
array('class' => array('page-summary-data'), 'data' => $text),
array('class' => array('page-summary-operation'), 'data' => $link),
);
$path = array();
foreach (explode('/', $page->path) as $bit) {
if ($bit[0] != '!') {
$path[] = $bit;
}
}
$path = implode('/', $path);
$front = variable_get('site_frontpage', 'node');
$link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'basic')));
$message = '';
if ($path == $front) {
$message = t('This is your site home page.');
}
else if (!empty($page->make_frontpage)) {
$message = t('This page is set to become your site home page.');
}
if ($message) {
$rows[] = array(
array('class' => array('page-summary-data'), 'data' => $message, 'colspan' => 2),
array('class' => array('page-summary-operation'), 'data' => $link),
);
}
if (strpos($path, '%') === FALSE) {
$path = l('/' . $page->path, $path);
}
else {
$path = '/' . $page->path;
}
$rows[] = array(
array('class' => array('page-summary-label'), 'data' => t('Path')),
array('class' => array('page-summary-data'), 'data' => $path),
array('class' => array('page-summary-operation'), 'data' => $link),
);
if (empty($access['plugins'])) {
$access['plugins'] = array();
}
$contexts = page_manager_page_get_contexts($task, $subtask);
$access = ctools_access_group_summary($page->access, $contexts);
if ($access) {
$access = t('Accessible only if @conditions.', array('@conditions' => $access));
}
else {
$access = t('This page is publicly accessible.');
}
$link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'access')));
$rows[] = array(
array('class' => array('page-summary-label'), 'data' => t('Access')),
array('class' => array('page-summary-data'), 'data' => $access),
array('class' => array('page-summary-operation'), 'data' => $link),
);
$menu_options = array(
'none' => t('No menu entry.'),
'normal' => t('Normal menu entry.'),
'tab' => t('Menu tab.'),
'default tab' => t('Default menu tab.'),
'action' => t('Local action'),
);
if (!empty($page->menu)) {
$menu = $menu_options[$page->menu['type']];
if ($page->menu['type'] != 'none') {
$menu .= ' ' . t('Title: %title.', array('%title' => $page->menu['title']));
switch ($page->menu['type']) {
case 'default tab':
$menu .= ' ' . t('Parent title: %title.', array('%title' => $page->menu['parent']['title']));
break;
case 'normal':
if (module_exists('menu')) {
$menus = menu_get_menus();
$menu .= ' ' . t('Menu block: %title.', array('%title' => $menus[$page->menu['name']]));
}
break;
}
}
}
else {
$menu = t('No menu entry');
}
$link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'menu')));
$rows[] = array(
array('class' => array('page-summary-label'), 'data' => t('Menu')),
array('class' => array('page-summary-data'), 'data' => $menu),
array('class' => array('page-summary-operation'), 'data' => $link),
);
$output .= theme('table', array('rows' => $rows, 'attributes' => array('id' => 'page-manager-page-summary')));
return $output;
}
/**
* Callback to enable/disable the page from the UI.
*/
function page_manager_page_enable(&$cache, $status) {
$page = &$cache->subtask['subtask'];
ctools_include('export');
ctools_export_set_object_status($page, $status);
$page->disabled = FALSE;
}
/**
* Recalculate the arguments when something like the path changes.
*/
function page_manager_page_recalculate_arguments(&$page) {
// Ensure $page->arguments contains only real arguments:
$arguments = page_manager_page_get_named_arguments($page->path);
$args = array();
foreach ($arguments as $keyword => $position) {
if (isset($page->arguments[$keyword])) {
$args[$keyword] = $page->arguments[$keyword];
}
else {
$args[$keyword] = array(
'id' => '',
'identifier' => '',
'argument' => '',
'settings' => array(),
);
}
}
$page->arguments = $args;
}
/**
* When adding or cloning a new page, this creates a new page cache
* and adds our page to it.
*
* This does not check to see if the existing cache is already locked.
* This must be done beforehand.
*
* @param &$page
* The page to create.
* @param &$cache
* The cache to use. If the cache has any existing task handlers,
* they will be marked for deletion. This may be a blank object.
*/
function page_manager_page_new_page_cache(&$page, &$cache) {
// Does a page already exist? If so, we are overwriting it so
// take its pid.
if (!empty($cache->subtask) && !empty($cache->subtask['subtask']) && !empty($cache->subtask['subtask']->pid)) {
$page->pid = $cache->subtask['subtask']->pid;
}
else {
$cache->new = TRUE;
}
$cache->task_name = page_manager_make_task_name('page', $page->name);
$cache->task_id = 'page';
$cache->task = page_manager_get_task('page');
$cache->subtask_id = $page->name;
$page->export_type = EXPORT_IN_DATABASE;
$page->type = t('Normal');
$cache->subtask = page_manager_page_build_subtask($cache->task, $page);
if (isset($cache->handlers)) {
foreach($cache->handlers as $id => $handler) {
$cache->handler_info[$id]['changed'] = PAGE_MANAGER_CHANGED_DELETED;
}
}
else {
$cache->handlers = array();
$cache->handler_info = array();
}
if (!empty($page->default_handlers)) {
foreach ($page->default_handlers as $id => $handler) {
page_manager_handler_add_to_page($cache, $handler);
}
}
$cache->locked = FALSE;
$cache->changed = TRUE;
}
/**
* Callback to determine if a page is accessible.
*
* @param $task
* The task plugin.
* @param $subtask_id
* The subtask id
* @param $contexts
* The contexts loaded for the task.
* @return
* TRUE if the current user can access the page.
*/
function page_manager_page_access_check($task, $subtask_id, $contexts) {
$page = page_manager_page_load($subtask_id);
return ctools_access($page->access, $contexts);
}