root / drupal7 / sites / all / modules / panels / panels_ipe / panels_ipe.api.php @ 2545992a
1 | 136a805a | Assos Assos | <?php
|
---|---|---|---|
2 | |||
3 | /**
|
||
4 | * @file
|
||
5 | * Hooks provided by Panels In-Place Editor.
|
||
6 | */
|
||
7 | |||
8 | /**
|
||
9 | * Allow modules to control access to the Panels IPE.
|
||
10 | *
|
||
11 | * @param panels_display $display
|
||
12 | * The panels display about to be rendered.
|
||
13 | *
|
||
14 | * @return TRUE|FALSE|NULL
|
||
15 | * Returns TRUE to allow access, FALSE to deny, or NULL if the module
|
||
16 | * implementing this hook doesn't care about access for the given display.
|
||
17 | */
|
||
18 | 2545992a | Assos Assos | function hook_panels_ipe_access(panels_display $display) { |
19 | 136a805a | Assos Assos | // We only care about displays with the 'panelizer' context.
|
20 | if (!isset($display->context['panelizer'])) { |
||
21 | return NULL; |
||
22 | } |
||
23 | |||
24 | if ($display->context['panelizer']->type[0] == 'entity:node') { |
||
25 | // Allow or deny IPE access based on node type.
|
||
26 | return $display->context['panelizer']->data->type == 'awesome_page'; |
||
27 | } |
||
28 | |||
29 | // Otherwise, deny access to everything!
|
||
30 | return FALSE; |
||
31 | } |