You are here

function opigno_poll_app_opigno_breadcrumbs in Opigno Poll App 7

Implements hook_opigno_breadcrumbs().

File

./opigno_poll_app.module, line 58
Module hooks.

Code

function opigno_poll_app_opigno_breadcrumbs($gid) {
  $breadcrumbs = array();
  $node = menu_get_object();

  // Must we handle this page request for the breadcrumb ?
  if (isset($node->type) && $node->type == 'poll' || current_path() == 'node/add/poll') {

    // Add the Opigno Polls view link.
    $breadcrumbs[] = l(opigno_poll_app_get_polls_view_title(), "node/{$gid}/polls");

    // Is this a sub page of the poll (like node/%/votes) ? Add the poll itself.
    if (isset($node->nid) && preg_match('/^node\\/[0-9]+\\/.+/', current_path())) {
      $breadcrumbs[] = l($node->title, "node/{$node->nid}");
    }
  }
  if (!empty($breadcrumbs)) {
    return $breadcrumbs;
  }
}