You are here

function bootstrap_tour_load_all in Bootstrap Tour 7.2

Same name and namespace in other branches
  1. 7 bootstrap_tour.module \bootstrap_tour_load_all()

Load all the tours (and caches them).

1 string reference to 'bootstrap_tour_load_all'
bootstrap_tour_bootstrap_tour_update in ./bootstrap_tour.module
Implements hook_bootstrap_tour_insert().

File

./bootstrap_tour.module, line 366
bootstrap_tour.module

Code

function bootstrap_tour_load_all($reset = FALSE) {
  $all_tours =& drupal_static(__FUNCTION__);
  if (!isset($all_tours) || $reset) {
    if (!$reset && ($cache = cache_get('bootstrap_tours_all'))) {
      $all_tours = $cache->data;
    }
    else {
      $all_tours = entity_load('bootstrap_tour');
      foreach ($all_tours as $id => $tour) {
        $wrapper = entity_metadata_wrapper('bootstrap_tour', $tour);
        $all_tours[$id]->steps = $wrapper->bootstrap_tour_step_reference
          ->value();
      }
      cache_set('bootstrap_tours_all', $all_tours);
    }
  }
  return $all_tours;
}