I have site with several rental properties where each rental property (node) has an Availability Calendar enabled and working perfectly.
I'd like to have a 'summary' page that shows the calendars for all the properties on one page. In a similar vein to the demonstration page.
As a fairly new Drupal user I couldn't see an option to achieve this. I'm guessing that maybe I could create a series of blocks and place them on a node, but I don't know how to get the block to render the AC for a specific node.
Any help appreciated.
Thanks.
Comments
Comment #1
geodaniel commentedThe way this is achieved on the demo page is through the use of a node with the PHP filter enabled. For each node you want to include the calendar for, you can then insert the following HTML:
(where
'nid' => 12is the node ID of the node you wish to show the calendar for)Comment #2
ianhaycox commentedPerfect.
Thanks very much.
Comment #3
JT33 commentedHi
I have been trying to adapt the solution above to D7, but no success so far. Did someone had a go at it?
Many thanks
JT
Comment #4
fietserwinD7 theme functions work with 1 variables array: all parameters to the theme are passed in via 1 array. The theme definition for availability_calendars_node expects the following parameters:
file availability_calendars.module:
Calling a theme function is done indirectly by using render arrays like in
file availability_calendars.page.inc function availability_calendars_page_node_view:
Or by calling the theme function directly:
The settings are passed in as a parameter to allow the calling code to overrule the stored settings in situations where needed. Normally you get them via a call to function availability_calendars_get_settings($scope, $nid).
Don't forget to include the files where these functions live in, they might not be loaded when your php code is executed:
theme functions:
or the get settings function:
(the latter will automatically be included on including the former).
Last note: be aware of the security risks of the PHP filter. You better not use this filter and use hooks to get the output you want, e.g. hook_preprocess_page and using render arrays to add content to your page.
Comment #5
JT33 commentedThank you for the prompt and detailed answer Fietserwin. It works fine now.
I also take your point on safety. Will work with a hook on the live version. Just trying a few things in local for the time being.
JT