You are here

function coffee_coffee_commands in Coffee 7.2

Same name and namespace in other branches
  1. 8 coffee.coffee.inc \coffee_coffee_commands()

Implements hook_coffee_commands().

File

./coffee.hooks.inc, line 11
The hooks that are used by Coffee includes an example of hook_coffee_commands().

Code

function coffee_coffee_commands() {
  $commands = array();

  // Add in a link for the frontpage.
  $commands[] = array(
    'value' => '',
    'label' => t('Go to front page'),
    'command' => ':front',
  );

  // Display the links of the node/add page.
  // The command is ":add" and includes the link_title to empower the
  // autocompletion.
  $path = 'node/add';
  $item = menu_get_item($path);
  $content_types = system_admin_menu_block($item);
  $command = ':add';
  foreach ($content_types as $content_type) {
    $commands[] = array(
      'value' => $content_type['link_path'],
      'label' => $content_type['link_title'],
      'command' => $command . ' ' . drupal_strtolower($content_type['link_title']),
    );
  }
  return $commands;
}