Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
can someone help me with the php code needed to make a customized availability calendar token? i need more flexibility in where the availability calendar is placed in the room type node page.
Comments
Comment #1
willvincent CreditAttribution: willvincent commentedI don't know whether that could really be done properly with tokens
I suppose one could create a token that had a format like [avail-mm-yy] that would be replaced with a calendar for that month of that year.. but I'm not sure whether that's a good solution or not.
What specifically are you trying to accomplish?
Looking at your site, I assume you'd like to get rid of the 3 month display thats showing up below your tabbed section for each rental?
If that's the case, the best solution might just be a theme preprocess function, if you're not able to theme the page so the calendars show up as you'd like.
I am curious how you managed to get both a 12 month display in a tab and the 3 month display below the tabbed section. Are you explicitly calling the function to build the list of calendars within that tabbed section? If you're doing that you could probably uncheck the "Display on node page" checkbox in the uc_hotel settings to turn off the others, or set the number of months to display to 0
Comment #2
clevername CreditAttribution: clevername commentedthe 3 month display below my tabbed section was just temporarily turned on while I was messing with the site yesterday.
in the tabbed section, i used a dynamic field with the php code
this was my workaround to give me more flexibility with where the avail calendar was placed on the page.
the problem is that I have to manually adjust the
$month = xx
portion every month to keep the display updated. im sure there is an easy fix, but my skills and patience are limited at this point. and im sure others would appreciate some flexibility with where the avail calendar is placed on the page.thanks again.
Newport Beach Vacation Rentals
Comment #3
willvincent CreditAttribution: willvincent commentedWell, if you're calling the function directly, you could just feed it with current values like this:
instead of $year = 2009, $year = date("Y", time())
and instead of $month = 12, $month = date("n", time())
Comment #4
clevername CreditAttribution: clevername commentedperfect. any thoughts on adding flexibility to where the body/avail calendar is placed on the page for future versions? should i leave this issue open as a feature request?
Comment #5
willvincent CreditAttribution: willvincent commentedA lot of the display elements will be moved into theme functions and templates in the future, so that will solve this issue. It's already in the works.
Comment #6
willvincent CreditAttribution: willvincent commented