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.
I need to feature April in the mini calendar. If I tack "?mini=calendar2/2009-04" onto the end of the URL of any page with the calendar, I get what I'm looking for. But how do I pass this info to the mini calendar behind the scenes?
Thanks,
Mickey
Comments
Comment #1
micnap CreditAttribution: micnap commentedJust a hint? Please?
Comment #2
KarenS CreditAttribution: KarenS commentedYou would have to configure the default value of the argument of the mini calendar. Select the 'Calendar block' of the calendar. Click on the date argument. Check the box to 'override' the argument so that the block will behave differently than the rest of the calendar. There is an option to set the default argument to the current date. Change it to set it to a fixed value for the argument instead and type in the value you want it to have. Do the same thing with the 'block view' (the mini calendar block is made up of two displays, the 'Calendar block' for the navigation and the 'block view' for the calendar itself).
Then don't forget to change it back when you do *not* want to feature April any more.
Comment #4
chaps2 CreditAttribution: chaps2 commentedHi, I've reopened this as I was trying to do the same thing but without success. The validation in the calendar argument handlers requires that the default argument is Current date as in this code here:
I had to comment this out in order to use the fixed entry and php code as the default argument.
However there's another problem with the views date argument handler which I commented on here http://drupal.org/node/333463#comment-1328040. Possible workaround would be to override get_default_argument in the calendar handlers and call the parent method with $raw = TRUE. But I'm not sure what other effects that may have.
Thanks,
Andy
Comment #5
sagannotcarl CreditAttribution: sagannotcarl commentedI am having the same problem with the dev version (from March 21). When I try to follow the instructions from #2 and set the default argument from Current Date to Fixed argument, I get the error:
The view will also not accept the other date options for default argument such as Current node's creation time or Current node's update time.
Because the instructions in comment #2 said something about two displays making up the calendar block I set the default display to use fixed argument, as well as just changing the two displays used. Every time I got the same error.
Comment #6
sagannotcarl CreditAttribution: sagannotcarl commentedchaps2,
In which file did you comment out that section? When I commented it out of a couple include files my block disappeared. Did you get this working or did that other views issue prevent it?
Comment #7
chaps2 CreditAttribution: chaps2 commentedFor the fix in #4 to work you need to uncomment those lines in the calendar plugins that your views use. Typically for blocks these will be includes/calendar_plugin_style.inc and includes/calendar_plugin_display_block.inc.
I would provide a patch for this but I think it needs comment from one of the maintainers as the code that I have commented out looks like it was put there for a reason.
It did work for me but you do need to apply fix to the views handler as mentioned in http://drupal.org/node/333463#comment-1328040.
Latest: the views bug is fixed in the latest release of views-6.x-2.x-dev dated 25 March 2009.
Comment #8
osopolarI changed the validate function in includes/calendar_plugin_display_block.inc and includes/calendar_plugin_style.inc to:
Now I'm able to use the following php code to provide a default value:
The date argument is the first one (after the view name).
Example: when I' viewing the web page http://cyber4kids.de/kalender or http://cyber4kids.de/kalender/heute (heute = today) I get the mini calendar for the current month when I'm viewing http://cyber4kids.de/kalender/2009-03-29 I get the calendar for 2009-03.
Comment #9
agentrickardSee the patch in #450082: Allow PHP-based default arguments
Comment #10
rismondo CreditAttribution: rismondo commentedI would also like to have the ability to specify a default (either by using PHP or a fixed string) for the calendar.
If I change the code in the manner described in this ticket (or the one linked above), I find that the default works, but then the mini calendar block disappears from all full node pages (the ones with an address like "/node/nnn"), even though it shows normally on the administration pages or the front page.
So this change may be insufficient.
Comment #11
osopolarRecently I had similar problem on a different D6 site (not sure how much has changed for D7, but it might be useful): Instead of using php in views as in #8 its better to use hook_views_pre_view() to provide the argument for the mini calendar.
Comment #12
Neslee Canil PintoThe D6 branch is no longer supported so we're closing this issue. If you think this issue still exists in D7 you can open a new one.