function hook_coffee_commands in Coffee 7.2
Same name and namespace in other branches
- 8 coffee.api.php \hook_coffee_commands()
Extend the Coffee functionality with your own commands and items.
Here's an example of how to add content to Coffee.
1 function implements hook_coffee_commands()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- coffee_coffee_commands in ./
coffee.hooks.inc - Implements hook_coffee_commands().
1 invocation of hook_coffee_commands()
- coffee_get_menu_response in ./
coffee.module - Function coffee_get_menu_response().
File
- ./
coffee.api.php, line 18 - Hooks provided by Coffee module.
Code
function hook_coffee_commands($op) {
$commands = array();
// Basic example, for 1 result.
$commands[] = array(
'value' => 'Simple',
'label' => 'node/example',
// Every result should include should include a command.
'command' => ':simple',
);
// More advanced example to include a view.
$view = views_get_view('my_entities_view');
if ($view) {
$view
->set_display('default');
$view
->pre_execute();
$view
->execute();
if (count($view->result) > 0) {
foreach ($view->result as $row) {
$commands[] = array(
'value' => ltrim(url('node/' . $row->nid), '/'),
'label' => check_plain('Pub: ' . $row->node_title),
// You can also specify commands that if the user enters, this command should show.
'command' => ':x',
);
}
}
}
return $commands;
}