diff --git contextual_links_example/contextual-links-example-object.tpl.php contextual_links_example/contextual-links-example-object.tpl.php
new file mode 100644
index 0000000..e8e6c06
--- /dev/null
+++ contextual_links_example/contextual-links-example-object.tpl.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @file
+ * Default theme implementation to display a sample object with contextual links.
+ *
+ * Available variables:
+ * - $title: The sanitized title of the object.
+ * - $content: The sanitized content of the object.
+ * These are defined in template_preprocess_contextual_links_example_object()
+ * and represent whichever variables you might actually use to display the
+ * main content of your module's object.
+ *
+ * Standard variables (required for contextual links):
+ * - $classes: String of classes that can be used to style contextually through
+ *   CSS.
+ * - $title_prefix (array): An array containing additional output populated by
+ *   modules, intended to be displayed in front of the main title tag that
+ *   appears in the template.
+ * - $title_suffix (array): An array containing additional output populated by
+ *   modules, intended to be displayed after the main title tag that appears in
+ *   the template.
+ * The above variables are a subset of those which Drupal provides to all
+ * templates, and they must be printed in your template file in order for
+ * contextual links to be properly attached. For example, the core Contextual
+ * Links module adds the renderable contextual links themselves inside
+ * $title_suffix, so they will appear immediately after the object's title in
+ * the HTML. (This placement is for accessibility reasons, among others.)
+ */
+?>
+<div class="<?php print $classes; ?>">
+  <?php print render($title_prefix); ?>
+  <h2><?php print $title; ?></h2>
+  <?php print render($title_suffix); ?>
+  <?php print $content; ?>
+</div>
diff --git contextual_links_example/contextual_links_example.info contextual_links_example/contextual_links_example.info
new file mode 100644
index 0000000..766de90
--- /dev/null
+++ contextual_links_example/contextual_links_example.info
@@ -0,0 +1,5 @@
+name = Contextual links example
+description = Demonstrates how to use contextual links for enhancing the user experience.
+package = Example modules
+core = 7.x
+files[] = contextual_links_example.test
diff --git contextual_links_example/contextual_links_example.module contextual_links_example/contextual_links_example.module
new file mode 100644
index 0000000..46974cf
--- /dev/null
+++ contextual_links_example/contextual_links_example.module
@@ -0,0 +1,343 @@
+<?php
+
+/**
+ * @file
+ * Shows how to use Drupal's contextual links functionality.
+ */
+
+/**
+ * Implements hook_menu().
+ *
+ * Drupal's menu system allows you to indicate that particular menu items
+ * should be displayed as contextual links. If you hover over a block or node
+ * while logged in as an administrator (and with the Contextual Links module
+ * enabled) you'll see a small gear icon appear. Click on this icon and the
+ * list of items that appears in the exposed menu are what Drupal calls
+ * "contextual links".
+ *
+ * Three examples of contextual links are provided here, ranging from easy to
+ * complex:
+ * - Attaching contextual links to a node.
+ * - Displaying your module's content in a block and attaching the content's
+ *   contextual links to the block.
+ * - Displaying your module's content on its own with the contextual links
+ *   attached directly to it.
+ *
+ * @see contextual_links_example_block_info()
+ * @see contextual_links_example_block_view()
+ * @see contextual_links_overview_page()
+ */
+function contextual_links_example_menu() {
+  // First example (attaching contextual links to a node):
+  //
+  // For objects which already take care of displaying their own contextual
+  // links, it is simple to add additional links to the list. In the case of
+  // nodes, the Node module already has code to display contextual links (such
+  // as "Edit" and "Delete") when a node is being rendered outside of its own
+  // page (e.g., when a teaser of the node is being displayed on the front page
+  // of the site).
+  //
+  // The example below adds an additional contextual link named "Example
+  // contextual action" to the list and is the only code necessary to do so.
+  $items['node/%node/contextual_links_example'] = array(
+    'title' => 'Example contextual action',
+    'page callback' => 'contextual_links_example_node_page',
+    'page arguments' => array(1),
+    'access callback' => TRUE,
+    // To be displayed as a contextual link, a menu item should be of type
+    // MENU_LOCAL_TASK. (It is also possible to do it for items of type
+    // MENU_DEFAULT_LOCAL_TASK or MENU_LOCAL_ACTION, although that is much less
+    // common.)
+    'type' => MENU_LOCAL_TASK,
+    // To make the local task display as a contextual link, specify the
+    // optional 'context' argument:
+    // - If 'context' is not specified, the default value is MENU_CONTEXT_PAGE.
+    //   This causes the link to display as a tab on its own page (in this case
+    //   at node/<nid>) but not as a contextual link.
+    // - If 'context' is set to MENU_CONTEXT_INLINE, the link is displayed in
+    //   the contextual links dropdown.
+    // - The most common method for displaying contextual links is to set both
+    //   MENU_CONTEXT_PAGE and MENU_CONTEXT_INLINE (shown below), which causes
+    //   the link to display as both a tab on the page and as an entry in the
+    //   contextual links dropdown. This is recommended for most cases because
+    //   not all users who have permission to visit the "Example contextual
+    //   action" page will necessarily have access to the contextual links
+    //   dropdown.
+    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
+    // We give the item a large weight so that it displays as the last tab as
+    // well as the last item inside the contextual links dropdown.
+    'weight' => 80,
+  );
+
+  // Second and third examples (attaching contextual links to your module's
+  // content):
+  //
+  // Here we assume that your module has a type of object ("contextual links
+  // example object") to which it wants to attach contextual links. The code
+  // below defines menu items for this object using a standard pattern, with
+  // "View" and "Edit object" as the object's local tasks, and makes the "Edit
+  // object" item display as a contextual link in addition to a tab.
+  $items['examples/contextual_links/%contextual_links_example_object'] = array(
+    'title' => 'Contextual links example object',
+    'page callback' => 'contextual_links_example_object_page',
+    'page arguments' => array(2),
+    'access callback' => TRUE,
+  );
+  $items['examples/contextual_links/%contextual_links_example_object/view'] = array(
+    'title' => 'View',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -10,
+  );
+  $items['examples/contextual_links/%contextual_links_example_object/edit'] = array(
+    'title' => 'Edit object',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('contextual_links_example_object_edit_form', 2),
+    'access callback' => TRUE,
+    'type' => MENU_LOCAL_TASK,
+    // As in our first example, this is the line of code that makes "Edit
+    // "object" display as a contextual link in addition to as a tab.
+    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
+  );
+  // Once the contextual links are defined here in hook_menu(), additional
+  // steps are required to make them actually display next to your module's
+  // content.
+  // - In the second example, we will display our module's content in a block
+  //   and then attach the content's contextual links to the block itself. This
+  //   occurs in contextual_links_example_block_info() and
+  //   contextual_links_example_block_view().
+  // - In the third example, we will display the module's content in a listing
+  //   on its own page and then attach the contextual links directly to each
+  //   piece of content in the listing. That is done in
+  //   contextual_links_overview_page(), as per the menu item defined below.
+  $items['examples/contextual_links_overview_page'] = array(
+    'title' => 'Contextual links example overview',
+    'page callback' => 'contextual_links_overview_page',
+    'access callback' => TRUE,
+  );
+
+  return $items;
+}
+
+/**
+ * Menu loader callback for the object defined by this module.
+ *
+ * @param $id
+ *   The ID of the object to load.
+ *
+ * @return
+ *   A fully loaded object, or FALSE if the object does not exist.
+ */
+function contextual_links_example_object_load($id) {
+  // In a real use case, this function might load an object from the database.
+  // For the sake of this example, we just define a stub object with a basic
+  // title and content for any numeric ID that is passed in.
+  if (is_numeric($id)) {
+    $object = new stdClass();
+    $object->id = $id;
+    $object->title = t('Title for example object @id', array('@id' => $id));
+    $object->content = t('This is the content of example object @id.', array('@id' => $id));
+    return $object;
+  }
+  else {
+    return FALSE;
+  }
+}
+
+/**
+ * Implements hook_block_info().
+ */
+function contextual_links_example_block_info() {
+  // Define the block that will display our module's content.
+  $blocks['example']['info'] = t('Contextual links example block');
+  return $blocks;
+}
+
+/**
+ * Implements hook_block_view().
+ */
+function contextual_links_example_block_view($delta = '') {
+  if ($delta == 'example') {
+    // Display our module's content inside a block. In a real use case, we
+    // might define a new block for each object that exists. For the sake of
+    // this example, though, we only define one block and hardcode it to always
+    // display object #1.
+    $id = 1;
+    $object = contextual_links_example_object_load($id);
+    $block['subject'] = t('Contextual links example block for object @id', array('@id' => $id));
+    $block['content'] = array(
+      // In order to attach contextual links, the block's content must be a
+      // renderable array. (Normally this would involved themed output, but for
+      // simplicity we just display the object's content as HTML markup here.)
+      '#type' => 'markup',
+      '#markup' => filter_xss($object->content),
+      // Contextual links are attached to the block array using the special
+      // #contextual_links property. The #contextual_links property contains an
+      // array, keyed by the name of each module that is attaching contextual
+      // links to it.
+      '#contextual_links' => array(
+        'contextual_links_example' => array(
+          // Each element is itself an array, containing two elements which are
+          // combined together to form the base path whose contextual links
+          // should be attached. The two elements are split such that the first
+          // is the static part of the path and the second is the dynamic part.
+          // (This split is for performance reasons.) For example, the code
+          // below tells Drupal to load the menu item corresponding to the path
+          // "examples/contextual_links/$id" and attach all this item's
+          // contextual links (which were defined in hook_menu()) to the object
+          // when it is rendered. If the contextual links you are attaching
+          // don't have any dynamic elements in their path, you can pass an
+          // empty array as the second element.
+          'examples/contextual_links',
+          array($id),
+
+        ),
+      ),
+    );
+    // Since we are attaching our contextual links to a block, and the Block
+    // module takes care of rendering the block in such a way that contextual
+    // links are supported, we do not need to do anything else here. When the
+    // appropriate conditions are met, the contextual links we have defined
+    // will automatically appear attached to the block, next to the "Configure
+    // block" link that the Block module itself provides.
+    return $block;
+  }
+}
+
+/**
+ * Menu callback; displays a listing of objects defined by this module.
+ *
+ * @see contextual_links_example_theme()
+ * @see contextual-links-example-object.tpl.php
+ * @see contextual_links_example_block_view()
+ */
+function contextual_links_overview_page() {
+  $build = array();
+
+  // For simplicity, we will hardcode this example page to list five of our
+  // module's objects.
+  for ($id = 1; $id <= 5; $id++) {
+    $object = contextual_links_example_object_load($id);
+    $build[$id] = array(
+      // To support attaching contextual links to an object that we are
+      // displaying on our own, the object must be themed in a particular way.
+      // See contextual_links_example_theme() and
+      // contextual-links-example-object.tpl.php for more discussion.
+      '#theme' => 'contextual_links_example_object',
+      '#object' => $object,
+      // Contextual links are attached to the block using the special
+      // #contextual_links property. See contextual_links_example_block_view()
+      // for discussion of the syntax used here.
+      '#contextual_links' => array(
+        'contextual_links_example' => array(
+          'examples/contextual_links',
+          array($id),
+        ),
+      ),
+    );
+  }
+
+  return $build;
+}
+
+/**
+ * Implements hook_theme().
+ *
+ * @see template_preprocess_contextual_links_example_object()
+ */
+function contextual_links_example_theme() {
+  // The core Contextual Links module imposes two restrictions on how an object
+  // must be themed in order for it to display the object's contextual links in
+  // the user interface:
+  // - The object must use a template file rather than a theme function. See
+  //   contextual-links-example-object.tpl.php for more information on how the
+  //   template file should be structured.
+  // - The first variable passed to the template must be a renderable array. In
+  //   this case, we accomplish that via the most common method, by passing a
+  //   single renderable element.
+  return array(
+    'contextual_links_example_object' => array(
+      'template' => 'contextual-links-example-object',
+      'render element' => 'element',
+    ),
+  );
+}
+
+/**
+ * Process variables for contextual-links-example-object.tpl.php.
+ *
+ * @see contextual_links_overview_page()
+ */
+function template_preprocess_contextual_links_example_object(&$variables) {
+  // Here we take the object that is being themed and define some useful
+  // variables that we will print in the template file.
+  $variables['title'] = filter_xss($variables['element']['#object']->title);
+  $variables['content'] = filter_xss($variables['element']['#object']->content);
+}
+
+/**
+ * Menu callback; displays an object defined by this module on its own page.
+ *
+ * @see contextual_links_overview_page()
+ */
+function contextual_links_example_object_page($object) {
+  // Here we render the object but without the #contextual_links property,
+  // since we don't want contextual links to appear when the object is already
+  // being displayed on its own page.
+  $build = array(
+    '#theme' => 'contextual_links_example_object',
+    '#object' => $object,
+  );
+
+  return $build;
+}
+
+/**
+ * Form callback; display the form for editing our module's content.
+ *
+ * @ingroup forms
+ * @see contextual_links_example_object_edit_form_submit()
+ */
+function contextual_links_example_object_edit_form($form, &$form_state, $object) {
+  $form['text'] = array(
+    '#markup' => t('This is the page that would normally allow you to edit object @id.', array('@id' => $object->id)),
+    '#prefix' => '<p>',
+    '#suffix' => '</p>',
+  );
+
+  $form['actions'] = array('#type' => 'actions');
+  $form['actions']['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Submit'),
+  );
+
+  return $form;
+}
+
+/**
+ * Submit handler for contextual_links_example_object_edit_form().
+ */
+function contextual_links_example_object_edit_form_submit($form, &$form_state) {
+  drupal_set_message(t('The form was submitted.'));
+}
+
+/**
+ * Page callback for use with the contextual link example.
+ *
+ * @param $node
+ *   The node object loaded by node/%node/contextual_links_example
+ */
+function contextual_links_example_node_page($node) {
+  $page['text'] = array(
+    '#markup' => t('You clicked on the "Example contextual action" contextual link for the node %node_title.', array('%node_title' => $node->title)),
+    '#prefix' => '<p>',
+    '#suffix' => '</p>'
+  );
+  $page['link'] = array(
+    '#type' => 'link',
+    '#title' => t('Return to previous page'),
+    '#href' => isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid,
+    '#prefix' => '<p>',
+    '#suffix' => '</p>'
+  );
+  return $page;
+}
diff --git contextual_links_example/contextual_links_example.test contextual_links_example/contextual_links_example.test
new file mode 100644
index 0000000..d60a973
--- /dev/null
+++ contextual_links_example/contextual_links_example.test
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @file
+ * Tests for the contextual links example module.
+ */
+class ContextualLinksExampleTestCase extends DrupalWebTestCase {
+  protected $web_user;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Contextual links example functionality',
+      'description' => 'Tests the behavior of the contextual links provided by the Contextual links example module.',
+      'group' => 'Examples',
+    );
+  }
+
+  /**
+   * Enable modules and create user with specific permissions.
+   */
+  public function setUp() {
+    parent::setUp('contextual', 'contextual_links_example');
+    $this->web_user = $this->drupalCreateUser(array('access contextual links', 'administer blocks'));
+    $this->drupalLogin($this->web_user);
+  }
+
+  /**
+   * Test the various contextual links that this module defines and displays.
+   */
+  function testContextualLinksExample() {
+    // Create a node and promote it to the front page. Then view the front page
+    // and verify that the "Example contextual action" contextual link works.
+    $node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
+    $this->drupalGet('');
+    $this->clickLink(t('Example contextual action'));
+    $this->assertRaw(t('You clicked on the "Example contextual action" contextual link for the node %node_title.', array('%node_title' => $node->title)));
+
+    // Visit our example overview page and click the third contextual link.
+    // This should take us to a page for editing the third object we defined.
+    $this->drupalGet('examples/contextual_links_overview_page');
+    $this->clickLink('Edit object', 2);
+    $this->assertUrl('examples/contextual_links/3/edit', array('query' => array('destination' => 'examples/contextual_links_overview_page')));
+
+    // Enable our module's block, go back to the front page, and click the
+    // "Edit object" contextual link that we expect to be there.
+    $edit['blocks[contextual_links_example_example][region]'] = 'sidebar_first';
+    $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
+    $this->drupalGet('');
+    $this->clickLink('Edit object');
+    $this->assertUrl('examples/contextual_links/1/edit', array('query' => array('destination' => 'node')));
+  }
+}
diff --git examples.index.php examples.index.php
index beab81a..bf00d67 100644
--- examples.index.php
+++ examples.index.php
@@ -8,6 +8,7 @@
  * - @link ajax_example.module Using AJAX forms @endlink
  * - @link batch_example.module Using the batch API @endlink
  * - @link block_example.module Defining blocks @endlink
+ * - @link contextual_links_example.module Defining contextual links @endlink
  * - @link dbtng_example.module Database examples (DBTNG) @endlink
  * - @link email_example.module Sending e-mail @endlink
  * - @link field_example.module Defining fields in the field API @endlink
@@ -28,4 +29,4 @@
  * - @link trigger_example.module Implementing triggers and actions @endlink
  * - @link vertical_tabs_example.module Using vertical tabs @endlink
  * - @link xmlrpc_example.module XML-RPC example @endlink
- */
\ No newline at end of file
+ */
diff --git menu_example/menu_example.module menu_example/menu_example.module
index c19b07d..ce7b1eb 100644
--- menu_example/menu_example.module
+++ menu_example/menu_example.module
@@ -258,6 +258,56 @@ function menu_example_menu() {
     'access callback' => TRUE,
     'weight' => 70,
   );
+
+  // Through the menu system you can also indicate that items should be
+  // displayed as contextual links. If you hover over a block or node while
+  // logged in as an administrator (and with the Contextual Links module
+  // enabled) you'll see a small gear icon appear. Click on this icon and the
+  // list of items that appears in the exposed menu are what Drupal calls
+  // "contextual links".
+  //
+  // For objects which already take care of displaying their own contextual
+  // links, it is simple to add additional links to the list. For example, the
+  // Node module already has code to display contextual links (such as "Edit"
+  // and "Delete") when a node is being rendered outside of its own page (e.g.,
+  // when a teaser of the node is being displayed on the front page of the
+  // site). The example below adds an additional contextual link named "Example
+  // contextual action" to the list.
+  $items['node/%node/menu_example'] = array(
+    'title' => 'Example contextual action',
+    'page callback' => '_menu_example_node_page',
+    'page arguments' => array(1),
+    'access callback' => TRUE,
+    // To be displayed as a contextual link, a menu item should be of type
+    // MENU_LOCAL_TASK. (It is also possible to do it for items of type
+    // MENU_DEFAULT_LOCAL_TASK or MENU_LOCAL_ACTION, although that is much less
+    // common.)
+    'type' => MENU_LOCAL_TASK,
+    // To make the local task display as a contextual link, specify the
+    // optional 'context' argument:
+    // - If 'context' is not specified, the default value is MENU_CONTEXT_PAGE.
+    //   This causes the link to display as a tab on its own page (in this case
+    //   at node/<nid>) but not as a contextual link.
+    // - If 'context' is set to MENU_CONTEXT_INLINE, the link is displayed in
+    //   the contextual links dropdown.
+    // - The most common method for displaying contextual links is to set both
+    //   MENU_CONTEXT_PAGE and MENU_CONTEXT_INLINE (shown below), which causes
+    //   the link to display as both a tab on the page and as an entry in the
+    //   contextual links dropdown. This is recommended for most cases because
+    //   not all users who have permission to visit the "Example contextual
+    //   action" page will necessarily have access to the contextual links
+    //   dropdown.
+    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
+    // We give the item a large weight so that it displays as the last tab as
+    // well as the last item inside the contextual links dropdown.
+    'weight' => 80,
+  );
+  // The above example only works because the Node module already has code to
+  // conditionally display all contextual links underneath the node/<nid> path
+  // when a node is being displayed. To attach contextual links to an object
+  // that does not already display them, additional steps are required. For a
+  // detailed example, see contextual_links_example.module.
+
   return $items;
 }
 
@@ -299,6 +349,28 @@ function _menu_example_menu_page($content = NULL, $arg1 = NULL, $arg2 = NULL) {
 }
 
 /**
+ * Page callback for use with the contextual link example.
+ *
+ * @param $node
+ *   The node object loaded by node/%node/menu_example
+ */
+function _menu_example_node_page($node) {
+  $page['text'] = array(
+    '#markup' => t('You clicked on the "Example contextual action" contextual link for the node %node_title.', array('%node_title' => $node->title)),
+    '#prefix' => '<p>',
+    '#suffix' => '</p>'
+  );
+  $page['link'] = array(
+    '#type' => 'link',
+    '#title' => t('Return to previous page'),
+    '#href' => isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid,
+    '#prefix' => '<p>',
+    '#suffix' => '</p>'
+  );
+  return $page;
+}
+
+/**
  * Implements hook_permission() to provide a demonstration access string.
  */
 function menu_example_permission() {
@@ -464,4 +536,4 @@ function menu_example_arg_optional_load($id) {
 function menu_example_arg_optional_to_arg($arg) {
   // If our argument is not provided, give a default of 99.
   return (empty($arg) || $arg == '%') ? 99 : $arg;
-}
\ No newline at end of file
+}
diff --git menu_example/menu_example.test menu_example/menu_example.test
index 536a97d..bfa0c9d 100644
--- menu_example/menu_example.test
+++ menu_example/menu_example.test
@@ -19,7 +19,7 @@ class MenuExampleTestCase extends DrupalWebTestCase {
    * Enable modules and create user with specific permissions.
    */
   public function setUp() {
-    parent::setUp('menu_example');
+    parent::setUp('contextual', 'menu_example');
   }
 
   /**
@@ -66,7 +66,7 @@ class MenuExampleTestCase extends DrupalWebTestCase {
     $this->assertText(t('Loaded value was jackpot! default'));
 
     // Create a user with permissions to access protected menu entry.
-    $web_user = $this->drupalCreateUser(array('access protected menu example'));
+    $web_user = $this->drupalCreateUser(array('access protected menu example', 'access contextual links'));
 
     // Use custom overridden drupalLogin function to verify the user is logged
     // in.
@@ -84,6 +84,13 @@ class MenuExampleTestCase extends DrupalWebTestCase {
     $this->assertResponse(200);
     $this->assertText('This menu entry will not show');
 
+    // Create a node and promote it to the front page. Then view the front page
+    // and verify that the "Example contextual action" contextual link works.
+    $node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
+    $this->drupalGet('');
+    $this->clickLink(t('Example contextual action'));
+    $this->assertRaw(t('You clicked on the "Example contextual action" contextual link for the node %node_title.', array('%node_title' => $node->title)));
+
     // Verify that the 'logout' link has been changed to 'salir', using an 
     // overridden drupalLogout function.
     $this->drupalLogout();
