This snippet shows you how to create contextual links in Drupal 7. If you don't know what contextual links are then those are the links in front end that come up from the ratchet.
Source code viewer
/** * Implements hook_contextual_links_view_alter(). */ function HOOK_contextual_links_view_alter(&$element, $items) { if ($element['#element']['#block']->module === 'HOOK') { 'title' => t('My Custom'), 'href' => 'admin/structure/my-custom', 'query' => drupal_get_destination(), ); } }Programming Language: PHP