In my project I render weekly presentation view on a page different from a node view page of the node that has the opening hours. In that case Drupal.settings.OpeningHours.categories empty because menu_get_object() function to get the node data.
I think that this can be changed and the node to come as argument in opening_hours_js_settings function.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

boyan.borisov’s picture

Status: Active » Needs review
FileSize
3.02 KB

I've created a patch.

mikl’s picture

Status: Needs review » Needs work

A few notes:

  1. +++ b/opening_hours.module
    @@ -508,7 +508,12 @@ function opening_hours_js_settings() {
    +    if($nid) {
    

    Should have a single space between if and (.

  2. +++ b/opening_hours.module
    @@ -656,10 +661,13 @@ function opening_hours_add_js($type = 'presentation', $nid = FALSE) {
    +  if($vars['node']) {
    

    Should have a single space between if and (.

  3. +++ b/opening_hours.module
    @@ -656,10 +661,13 @@ function opening_hours_add_js($type = 'presentation', $nid = FALSE) {
    +  }
    

    Add a line break here.

boyan.borisov’s picture

Title: Categories are missing Drupal.settings » Categories are missing in Drupal.settings
moonray’s picture

Status: Needs work » Needs review
FileSize
3.01 KB

Attached patch fixes the formatting issues described above (none of the code has been changed).
Also, this tweak makes a custom block with opening hours work on pages that are not the node that they are attached to.

  • mikl committed 04ff8ca on 7.x-1.x authored by boyan.borisov
    Issue #2409713 by boyan.borisov, moonray: Categories are missing in...
mikl’s picture

Status: Needs review » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.