root / drupal7 / sites / all / modules / panelizer / panelizer.api.php @ 2cf41c1d
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
*
|
5 |
* Documentation for Panelizer's hooks.
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Allow panelizer_defaults_override to be customized.
|
10 |
*
|
11 |
* Primarily for use by Features Overrides.
|
12 |
*/
|
13 |
function hook_panelizer_defaults_override_alter(&$items) { |
14 |
} |
15 |
|
16 |
/**
|
17 |
* Add operations to Panelizer objects.
|
18 |
*
|
19 |
* Operations can be performed on panelizer defaults as well as entities.
|
20 |
* Panelizer provides the 4 default operations, but modules can add
|
21 |
* additional operations to add additional functionality.
|
22 |
*
|
23 |
* Data can be stored in $panelizer->extra which is a serialized array.
|
24 |
* Modules should be sure to namespace their keys in this extra to avoid
|
25 |
* collisions.
|
26 |
*
|
27 |
* Each operation supports the following keys:
|
28 |
* - 'menu title': The title to use in menu tab entries. This will be
|
29 |
* translated by the menu system, so do not t() it.
|
30 |
* - 'link title': The title to use in links. This will not be translated by
|
31 |
* the menu system, so t() it. In Drupal, the link title is typically in
|
32 |
* lower case when the tab would be in upper case, so this will not quite
|
33 |
* match the menu title.
|
34 |
* - 'entity callback': If not using the normal operation hook on the object,
|
35 |
* put this may be a function callback. It will receive the following args:
|
36 |
* $handler, $js, $input, $entity, $view_mode.
|
37 |
* - 'admin callback': The callback to use when editing a panelizer default.
|
38 |
* It will receive the following arguments: $handler, $bundle, $name,
|
39 |
* $view_mode.
|
40 |
* - 'file path': A 'file path' entry to be used for hook_menu entries.
|
41 |
* - 'file': A 'file' entry to be used for hook_menu entries.
|
42 |
*/
|
43 |
function hook_panelizer_operations_alter(&$operations) { |
44 |
$operations['example'] = array( |
45 |
'menu title' => 'Example', |
46 |
'link title' => t('example'), |
47 |
'entity callback' => 'mymodule_panelizer_example_entity_page', |
48 |
'admin callback' => 'mymodule_panelizer_example_admin_page', |
49 |
); |
50 |
} |
51 |
|
52 |
/**
|
53 |
* Allow panelizer_entity_plugin_process to be customized.
|
54 |
*/
|
55 |
function hook_panelizer_entity_plugin_process_alter(&$plugin, $info) { |
56 |
} |
57 |
|
58 |
/**
|
59 |
* Allow the links on the Overview page to be customized.
|
60 |
*/
|
61 |
function hook_panelizer_overview_links_alter(&$links_array, $entity_type, $context) { |
62 |
} |
63 |
|
64 |
/**
|
65 |
* Act on default objects just before they're deleted.
|
66 |
*
|
67 |
* @param object $panelizer
|
68 |
* The panelizer default object.
|
69 |
*/
|
70 |
function hook_panelizer_delete_default($panelizer) { |
71 |
db_delete('example_something')
|
72 |
->condition('name', $panelizer->name) |
73 |
->execute(); |
74 |
} |
75 |
|
76 |
/**
|
77 |
* Adjust access to the Panelizer administrative interface beyond the standard
|
78 |
* permissions options.
|
79 |
*
|
80 |
* @param string $op
|
81 |
* The operation currently being performed.
|
82 |
* @param string $entity_type
|
83 |
* The type of entity to which the operation is related.
|
84 |
* @param string|object $bundle
|
85 |
* Either the entity's bundle name or the entity object itself, will vary
|
86 |
* depending upon how it is called.
|
87 |
* @param string $view_mode
|
88 |
* The view mode of the entity related to this operation.
|
89 |
*
|
90 |
* @return bool
|
91 |
* Whether or not the user has permission to perform this $op.
|
92 |
*/
|
93 |
function hook_panelizer_access($op, $entity_type, $bundle, $view_mode) { |
94 |
} |
95 |
|
96 |
/**
|
97 |
* Allow modules to alter the defined panelizer access definitions.
|
98 |
*
|
99 |
* @param array $panelizer_access
|
100 |
* An array of panelizer access options. If any are true, this will return
|
101 |
* true. Set $panelizer_access equal to an empty array to return false.
|
102 |
* @param $options
|
103 |
* drupal_alter() can only handle so many parameters. In order to pass the
|
104 |
* same parameters that are passed in hook_panelizer_access, the params are
|
105 |
* placed into an $options array. Expected keys are:
|
106 |
* op
|
107 |
* entity_type
|
108 |
* bundle
|
109 |
* view_mode
|
110 |
*/
|
111 |
function hook_panelizer_access_alter(&$panelizer_access, $options) { |
112 |
} |