Skip to content

Commit

Permalink
Missing home page context bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sherakama committed Apr 9, 2015
1 parent 6332d9f commit adcdc62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
5 changes: 1 addition & 4 deletions stanford_jumpstart_home.context.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,16 @@ function stanford_jumpstart_home_get_contexts($clear_cache = FALSE) {
$cache = cache_get('jumpstart_home_context');
$contexts = array();

if (!$clear_cache && is_object($cache) && !isset($cache->data[''])) {
//watchdog('stanford_jumpstart_home', 'Used cache information for context blob', array(), WATCHDOG_DEBUG);
if (!$clear_cache && is_object($cache) && !isset($cache->data['']) && count($cache->data)) {
$contexts = $cache->data;
}
else {
$dir = drupal_get_path('module', 'stanford_jumpstart_home') . '/layouts';
//watchdog('stanford_jumpstart_home', 'Path to jumpstart_home: %dir' , array("%dir" => $dir), WATCHDOG_DEBUG);
$mask = "/.*\.inc$/";
$options['key'] = 'name';
$files = file_scan_directory($dir, $mask, $options);

foreach ($files as $name => $data) {
//watchdog('stanford_jumpstart_home', 'Path to context file: %dir' , array("%dir" => DRUPAL_ROOT . "/" . $data->uri), WATCHDOG_DEBUG);
include DRUPAL_ROOT . "/" . $data->uri;
$contexts[$context->name] = $context;
}
Expand Down
20 changes: 17 additions & 3 deletions stanford_jumpstart_home.module
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ function stanford_jumpstart_home_menu() {
return $items;
}

/**
* Load up the cache!
*/
function stanford_jumpstart_home_init() {
// if (drupal_is_front_page()) {
// module_load_include("inc", "stanford_jumpstart_home", "stanford_jumpstart_home.context");
// $jumpstart_contexts = stanford_jumpstart_home_context_default_contexts();
// $contexts = context_get();
// $keys = array_keys($jumpstart_contexts);
// if (!count($jumpstart_contexts) || !in_array($keys, $contexts->context)) {
// context_invalidate_cache();
// stanford_jumpstart_home_get_contexts(TRUE);
// module_invoke_all("default_contexts");
// }
// }
}

/**
* The dashboard functionality for the home page.
* @return [type] [description]
Expand Down Expand Up @@ -439,9 +456,6 @@ function stanford_jumpstart_home_preprocess_html(&$vars) {

$settings = variable_get('sjh_' . $context_name, null);
$vars['classes_array'][] = "active-home-context";
// foreach ($body_classes as $body_class) {
// $vars['classes_array'][] = drupal_clean_css_identifier($body_class);
// }
if (!isset($vars['classes'])) {
$vars['classes'] = "";
}
Expand Down

0 comments on commit adcdc62

Please sign in to comment.