1 contextual_links_example.module contextual_links_overview_page()

Menu callback; displays a listing of objects defined by this module.

See also

contextual_links_example_theme()

contextual-links-example-object.tpl.php

contextual_links_example_block_view()

Related topics

File

modules/examples/contextual_links_example/contextual_links_example.module, line 237
Hooks implementations for the Contextual Links Example module.

Code

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;
}