You are here

function hook_coffee_command in Coffee 7

Same name and namespace in other branches
  1. 6 coffee.api.php \hook_coffee_command()

Extend the Coffee functionallity with your own commands.

This hook is run when the input in Coffee starts with a colon (:), it passes the keyword after the colon as parameter to the hook.

You can define your own operators.

Parameters

string $op: This is the keyword used after the colon.

Return value

array An associative array whose keys are unique and whose values are an associative array containing:

  • title: A string used to display the title.
  • path: A string used for redirection to the path.

Although there isn't a limitation of a maximum number of items to display, please consider a maximum of 7 items or less, this because of the usability of Coffee.

1 function implements hook_coffee_command()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

coffee_coffee_command in ./coffee.hooks.inc
Implements hook_coffee_command().
1 invocation of hook_coffee_command()
coffee_result_handler in ./coffee.module
Handler for Coffee

File

./coffee.api.php, line 34
Hooks provided by Coffee module.

Code

function hook_coffee_command($op) {
  switch ($op) {

    // Is called when a user inputs :your operator.
    case 'your operator':
      $return = array(
        'item 1' => array(
          'path' => '',
          'title' => '',
        ),
        'item 2' => array(
          'path' => '',
          'title' => '',
        ),
      );
      break;
  }
  if (isset($return)) {
    return $return;
  }
}