function hook_gallery_assist_api in Gallery Assist 6
It extend the output from a Gallery Assist image in the preview with added code and implemented functionalities by other modules.
http://www.drupal.org/project/gallery_assist_comments
Parameters
string $op: Action options. Posible values:
- load:
- view:
- item_delete:
- delete:
integer $pid: The image ID.
object $node_light: An object containing the following values:
- uid: The user ID.
- nodetype: The node type.
- nid: The node ID.
- ref: The node translation reference ID.
- gid: The gallery ID
- gref: The gallery translation reference ID.
- pid: The image ID.
- preview_size: The preview size. Important to use for the layout.
- extra_styles:
An example of usage of this hook is live available from:
5 invocations of hook_gallery_assist_api()
- gallery_assist_delete in ./
gallery_assist.module - Implementation of hook_delete().
- gallery_assist_display_item_default in ./
gallery_assist.module - Build the output to display each gallery image. Call the own pager and the theme.
- gallery_assist_nodeapi in ./
gallery_assist.module - Implementation of hook_nodeapi().
- gallery_assist_save in ./
gallery_assist.module - Implementation of hook_save().
- gallery_assist_update in ./
gallery_assist.module - Implementation of hook_update().
File
- doc/
hooks.php, line 46 - This file provide additional documentation for doxygen. These are the hooks that are invoked by the Gallery Assist core.
Code
function hook_gallery_assist_api($op, $pid, $node_light) {
$output = array();
switch ($op) {
case 'load':
// example code here...
break;
case 'view':
// The returned code can be an string.
$output = your_function('Code (string)');
// An simple array().
$output = array(
'#value' => your_function('Code (string)'),
'#weight' => 20,
);
// Or an array() with multiple keys.
$output['field_name_1'] = array(
'#value' => your_function('Code (string)'),
'#weight' => 15,
'#prefix' => '<div style="height:20px;background:maroon;"></div>',
'#suffix' => '<div style="height:20px;background:maroon;"></div>',
);
// Other example with array().
$output['field_name_2'] = array(
'#value' => your_function('Code (string)'),
'#weight' => 15,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#prefix' => '<div style="height:20px;background:maroon;"></div>',
'#suffix' => '<div style="height:20px;background:maroon;"></div>',
);
return $output;
break;
case 'item_delete':
// example code here...
break;
case 'delete':
// example code here...
break;
}
}