You are here

coffee.hooks.inc in Coffee 7.2

Same filename and directory in other branches
  1. 6 coffee.hooks.inc
  2. 7 coffee.hooks.inc

The hooks that are used by Coffee includes an example of hook_coffee_commands().

File

coffee.hooks.inc
View source
<?php

/**
 * @file
 * The hooks that are used by Coffee
 * includes an example of hook_coffee_commands().
 */

/**
 * Implements hook_coffee_commands().
 */
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;
}

Functions