You are here

function opigno_quiz_app_get_quizzes_view_title in Opigno Quiz App 7

Helper function to get the Opigno Quizzes View title.

As the title might change depending on individual configuration, fetch it here and cache it for better performance.

Return value

string

1 call to opigno_quiz_app_get_quizzes_view_title()
opigno_quiz_app_opigno_breadcrumbs in ./opigno_quiz_app.module
Implements hook_opigno_breadcrumbs().

File

./opigno_quiz_app.module, line 768
Module file. Defines module hooks.

Code

function opigno_quiz_app_get_quizzes_view_title() {
  $cache = cache_get('opigno_quiz_app:view_title:opigno_quizzes');
  if ($cache) {
    return $cache->data;
  }
  else {
    $view = views_get_view('opigno_quizzes');
    if (!empty($view->display['default']->display_options['title'])) {
      $quiz_view_title = $view->display['default']->display_options['title'];
    }
    else {
      $quiz_view_title = t("Quizzes");
    }
    cache_set('opigno_quiz_app:view_title:opigno_quizzes', $quiz_view_title, 'cache', CACHE_TEMPORARY);
    return $quiz_view_title;
  }
}