@@ -30,6 +30,8 @@ function hook_ctools_plugin_type() {
30
30
}
31
31
32
32
/**
33
+ * Tells CTools where to find module-defined plugins.
34
+ *
33
35
* This hook is used to inform the CTools plugin system about the location of a
34
36
* directory that should be searched for files containing plugins of a
35
37
* particular type. CTools invokes this same hook for all plugins, using the
@@ -104,12 +106,12 @@ function hook_ctools_plugin_directory($owner, $plugin_type) {
104
106
* This hook is useful for altering flags or other information that will be
105
107
* used or possibly overriden by the process hook if defined.
106
108
*
107
- * @param $plugin
109
+ * @param array $plugin
108
110
* An associative array defining a plugin.
109
- * @param $info
111
+ * @param array $info
110
112
* An associative array of plugin type info.
111
113
*/
112
- function hook_ctools_plugin_pre_alter (&$ plugin , &$ info ) {
114
+ function hook_ctools_plugin_pre_alter (array &$ plugin , array &$ info ) {
113
115
// Override a function defined by the plugin.
114
116
if ($ info ['type ' ] == 'my_type ' ) {
115
117
$ plugin ['my_flag ' ] = 'new_value ' ;
@@ -122,12 +124,12 @@ function hook_ctools_plugin_pre_alter(&$plugin, &$info) {
122
124
* This hook is useful for overriding the final values for a plugin after it
123
125
* has been processed.
124
126
*
125
- * @param $plugin
127
+ * @param array $plugin
126
128
* An associative array defining a plugin.
127
- * @param $info
129
+ * @param array $info
128
130
* An associative array of plugin type info.
129
131
*/
130
- function hook_ctools_plugin_post_alter (&$ plugin , &$ info ) {
132
+ function hook_ctools_plugin_post_alter (array &$ plugin , array &$ info ) {
131
133
// Override a function defined by the plugin.
132
134
if ($ info ['type ' ] == 'my_type ' ) {
133
135
$ plugin ['my_function ' ] = 'new_function ' ;
@@ -144,46 +146,71 @@ function hook_ctools_plugin_post_alter(&$plugin, &$info) {
144
146
* An array of informations about the implementors of a certain api.
145
147
* The key of this array are the module names/theme names.
146
148
*/
147
- function hook_ctools_api_hook_alter (&$ list ) {
149
+ function hook_ctools_api_hook_alter (array &$ list ) {
148
150
// Alter the path of the node implementation.
149
151
$ list ['node ' ]['path ' ] = drupal_get_path ('module ' , 'node ' );
150
152
}
151
153
152
154
/**
153
155
* Alter the available functions to be used in ctools math expression api.
154
156
*
155
- * One usecase would be to create your own function in your module and
157
+ * One use case would be to create your own function in your module and
156
158
* allow to use it in the math expression api.
157
159
*
158
- * @param $functions
160
+ * @param array $functions
159
161
* An array which has the functions as value.
162
+ * @param array $context
163
+ * An array containing an item 'final' whose value is a reference to the
164
+ * definitions for multiple-arg functions. Use this to add in functions that
165
+ * require more than one arg.
160
166
*/
161
- function hook_ctools_math_expression_functions_alter (&$ functions ) {
162
- // Allow to convert from degrees to radiant .
167
+ function hook_ctools_math_expression_functions_alter (array &$ functions, array $ context ) {
168
+ // Allow to convert from degrees to radians .
163
169
$ functions [] = 'deg2rad ' ;
170
+
171
+ $ multiarg = $ context ['final ' ];
172
+ $ multiarg ['pow ' ] = array (
173
+ 'function ' => 'pow ' ,
174
+ 'arguments ' => 2 ,
175
+ );
176
+ }
177
+
178
+ /**
179
+ * Alter the available functions to be used in ctools math expression api.
180
+ *
181
+ * One usecase would be to create your own function in your module and
182
+ * allow to use it in the math expression api.
183
+ *
184
+ * @param array $constants
185
+ * An array of name:value pairs, one for each named constant. Values added
186
+ * to this array become read-only variables with the value assigned here.
187
+ */
188
+ function hook_ctools_math_expression_constants_alter (array &$ constants ) {
189
+ // Add the speed of light as constant 'c':
190
+ $ constants ['c ' ] = 299792458 ;
164
191
}
165
192
166
193
/**
167
194
* Alter everything.
168
195
*
169
- * @param $info
196
+ * @param array $info
170
197
* An associative array containing the following keys:
171
198
* - content: The rendered content.
172
199
* - title: The content's title.
173
200
* - no_blocks: A boolean to decide if blocks should be displayed.
174
- * @param $page
201
+ * @param bool $page
175
202
* If TRUE then this renderer owns the page and can use theme('page')
176
203
* for no blocks; if false, output is returned regardless of any no
177
204
* blocks settings.
178
- * @param $context
205
+ * @param array $context
179
206
* An associative array containing the following keys:
180
207
* - args: The raw arguments behind the contexts.
181
208
* - contexts: The context objects in use.
182
209
* - task: The task object in use.
183
210
* - subtask: The subtask object in use.
184
211
* - handler: The handler object in use.
185
212
*/
186
- function hook_ctools_render_alter (&$ info , &$ page , &$ context ) {
213
+ function hook_ctools_render_alter (array &$ info , &$ page , array &$ context ) {
187
214
if ($ context ['handler ' ]->name == 'my_handler ' ) {
188
215
ctools_add_css ('my_module.theme ' , 'my_module ' );
189
216
}
@@ -219,7 +246,7 @@ function hook_ctools_content_subtype_alter($subtype, $plugin) {
219
246
* @param string $plugin_id
220
247
* The plugin ID, in the format NAME:KEY.
221
248
*/
222
- function hook_ctools_entity_context_alter (&$ plugin , &$ entity , $ plugin_id ) {
249
+ function hook_ctools_entity_context_alter (array &$ plugin , array &$ entity , $ plugin_id ) {
223
250
ctools_include ('context ' );
224
251
switch ($ plugin_id ) {
225
252
case 'entity_id:taxonomy_term ' :
@@ -242,13 +269,13 @@ function hook_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) {
242
269
* A string associated with the plugin type, identifying the operation.
243
270
* @param string $value
244
271
* The value being converted; this is the only return from the function.
245
- * @param $converter_options
272
+ * @param array $converter_options
246
273
* Array of key-value pairs to pass to a converter function from higher
247
274
* levels.
248
275
*
249
276
* @see ctools_context_convert_context()
250
277
*/
251
- function hook_ctools_context_converter_alter ($ context , $ converter , &$ value , $ converter_options ) {
278
+ function hook_ctools_context_converter_alter (ctools_context $ context , $ converter , &$ value , array $ converter_options ) {
252
279
if ($ converter === 'mystring ' ) {
253
280
$ value = 'fixed ' ;
254
281
}
@@ -262,7 +289,7 @@ function hook_ctools_context_converter_alter($context, $converter, &$value, $con
262
289
*
263
290
* @see hook_ctools_entity_context_alter()
264
291
*/
265
- function hook_ctools_entity_contexts_alter (&$ plugins ) {
292
+ function hook_ctools_entity_contexts_alter (array &$ plugins ) {
266
293
$ plugins ['entity_id:taxonomy_term ' ]['no ui ' ] = TRUE ;
267
294
}
268
295
@@ -274,7 +301,7 @@ function hook_ctools_entity_contexts_alter(&$plugins) {
274
301
*
275
302
* @see ctools_cleanstring()
276
303
*/
277
- function hook_ctools_cleanstring_alter (&$ settings ) {
304
+ function hook_ctools_cleanstring_alter (array &$ settings ) {
278
305
// Convert all strings to lower case.
279
306
$ settings ['lower case ' ] = TRUE ;
280
307
}
@@ -287,7 +314,7 @@ function hook_ctools_cleanstring_alter(&$settings) {
287
314
*
288
315
* @see ctools_cleanstring()
289
316
*/
290
- function hook_ctools_cleanstring_CLEAN_ID_alter (&$ settings ) {
317
+ function hook_ctools_cleanstring_CLEAN_ID_alter (array &$ settings ) {
291
318
// Convert all strings to lower case.
292
319
$ settings ['lower case ' ] = TRUE ;
293
320
}
@@ -304,7 +331,7 @@ function hook_ctools_cleanstring_CLEAN_ID_alter(&$settings) {
304
331
*
305
332
* @see ctools_context_handler_pre_render()
306
333
*/
307
- function ctools_context_handler_pre_render ($ handler , $ contexts , $ args ) {
334
+ function ctools_context_handler_pre_render ($ handler , array $ contexts , array $ args ) {
308
335
$ handler ->conf ['css_id ' ] = 'my-id ' ;
309
336
}
310
337
0 commit comments