Using the office hours display code

exobuzz - May 7, 2009 - 18:55
Project:Office Hours
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am writing a custom template and I wanted to display the office hours data. I am using this code

      print_r($centre_node->field_openinghours);
      print theme('office_hours_formatter_default',$centre_node->field_openinghours);

where $centre_node->field_openinghours contains
Array
(
    [0] => Array
        (
            [day] =>
            [starthours] =>
            [endhours] =>
        )

    [1] => Array
        (
            [day] => 1
            [starthours] => 1000
            [endhours] => 1600
        )
...etc

Although nothing is displayed. Do you know what I am doing wrong ? (I am relatively new to drupal development but this seemed the way to call a module template function from your own template)

#1

exobuzz - May 7, 2009 - 21:14

Looking at the theme_office_hours_formatter_default code, it looks as though I'm passing it the wrong data. it wants some structure with #field_name, #type_name.

I think I am a bit closer. I need to use node_build_content I think, and then pass the ->content['field_openinghours'] to your theme function, but it doesnt work (yet). I guess it might just be easier for me to process the display manually.

 
 

Drupal is a registered trademark of Dries Buytaert.