function opigno_quiz_app_opigno_breadcrumbs in Opigno Quiz App 7
Implements hook_opigno_breadcrumbs().
File
- ./
opigno_quiz_app.module, line 446 - Module file. Defines module hooks.
Code
function opigno_quiz_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 == 'quiz' || current_path() == 'node/add/quiz' || preg_match('/^node\\/[0-9]+\\/sort-quizzes$/', current_path()) || opigno_quiz_app_is_node_add_question()) {
// Add the Opigno Quizzes view link.
$breadcrumbs[] = l(opigno_quiz_app_get_quizzes_view_title(), "node/{$gid}/quizzes");
// Is this a sub page of the quiz (like node/%/take) ? Add the Quiz itself.
if (isset($node->type) && $node->type == 'quiz' && preg_match('/^node\\/[0-9]+\\/.+/', current_path())) {
$breadcrumbs[] = l($node->title, "node/{$node->nid}");
}
// Is this a question add form ? And the parent Quiz NID is given in the URL ?
// Add the parent Quiz title and the manage question tab.
if (opigno_quiz_app_is_node_add_question() && !empty($_GET['quiz_nid'])) {
$quiz = node_load($_GET['quiz_nid']);
$breadcrumbs[] = l($quiz->title, "node/{$_GET['quiz_nid']}");
$breadcrumbs[] = l(t("Manage questions"), "node/{$_GET['quiz_nid']}/questions");
}
}
if (!empty($breadcrumbs)) {
return $breadcrumbs;
}
}