Hello,

I just noticed that when using AC with Views to sort available items, the calendar widget doesn't show the month related to the user search.
It displays the current month, while the calendar formlet gets the proper values (using $_GET[available][from][date] and $_GET[available][to1][date]).

I saw this issue : https://www.drupal.org/node/2373631
Would the patch provided there be a solution ?
If so, i would need a quick explanation on how to use that feature, I tried to use the latest dev version, but couldn't figure how to set the start date for the calendar..

Any help on this question would be very helpful
Thanks
-pacôme-

Comments

fietserwin’s picture

Category: Bug report » Feature request

I'm not sure I understand you correctly.

Say, you filter on availability for e..g the Christmas period and when viewing the results, the calendars show the current month, November, instead of December? Am I correct?

If so, I guess this is expected behavior. If you filter on availability, you only show those entities that are available during the specified period. But you are showing the teaser (or a custom set of fields) and if the a.c. is part of the teaser it shows as normal, that is: the total number of months as specified in the formatter settings; the number of visible months also as specified in the formatter settings; and the initial state being to show the current month.

I can imagine that in the above context it would be more logical to show the selected period as initial state, but that you would still be able to scroll forward and backward as normally. Therefore I am changing this into a feature request.

The mentioned issue would not help here, as that wold prevent scrolling back through time. in the case above, you would not be able to see November, as the start date would be December.

pacome’s picture

Hello Fietserwin,

thanks for your quick reply.
Yes, you are right with the exemple you used, and following your explanation i understand the logic behind the expected behavior.
And i agree that in the context we are talking about, it would make sens to show the selected period as initial state for the AC displayed in teaser or so.. that's what i've tried to mean in my first post ;)

That being said, do you have any idea on how to get this behavior ? Should i used a pre-process function ? (i'm not that familiar with it, but i use that from time to time, so -with some hints- i can give it a try)
Otherwise, something like the system used for the calendar formlet would be great (the $_GET value i mentioned above).

Thanks for your advices and for taking good care of this module, it's a great one!

fietserwin’s picture

Do you have any idea on how to get this behavior

Unfortunately not. It should be done on the client side, so it probably needs a (Drupal.)setting and some js. The setting would be part of the A.C. viewport settings that are already sent to the client. The js that shows the calendar then should offset the calendar to the right month. This should not be too hard, as showing the next 1, 2 or whatever months is already implemented. Giving the setting a value, could probably indeed be controlled via the $_GET.

pacome’s picture

thanks for your answer fietserwin,
i will see if i can find a solution and will post it here if i end up with something usable.
-p-