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'm unsure if this had been discussed, I have not found it in the issue queue.
Like with many other calendar systems, often when you're viewing a calendar which you can edit, you should be able to generally click on one of the dates in that calendar to create a new event node with the corresponding date field prefilled to the date clicked. I am aware of the 'Add event' link that you can put at the top of the display, but in that case you still have to fill in the date manually.
Is this feature possible? Is it planned?
Thanks for your valuable time.
Comments
Comment #1
apoc1 CreditAttribution: apoc1 commentedI've been searching for a solution to this for a long time now, anyone who knows how to get this function working?
Comment #2
tmsimont CreditAttribution: tmsimont commentedI'm actually currently working on this very feature as a stand-alone module. What I've been working on is much more complex, but as part of my effort I spent a lot of time making the calendar plugin style more extensible.
If you use this patch:
http://drupal.org/node/1908018#comment-7035384
and then create a new module that implements hook_views_plugins (I used a module called "pattern"):
Then in a file called "includes/pattern_style_plugin.inc" you can use something like this code:
Notice in that last part, I'm injecting the text "BUCKET!" into the calendar at each day of a month. This will only work on a month view, I haven't get it set up for year/week/day yet.
There's a property of the "weekday" called
$this->plugin
. You can use$this->plugin->curday
to get the current date and replace the text "BUCKET" with a link to add a date. You'll have to pass the date with a query string or a special arugment or something... still a lot to do between the code I've got and what you need but hopefully that's helpfulI'll post back anything I put up online regarding that stand-alone module I'm building.
Comment #3
apoc1 CreditAttribution: apoc1 commentedInteresting code you got there! I didn't think that far (maybe as my php knowledge is little..). Will you submit your stand-alone module to the community? Otherwise, I just wait till you post it, before I get messing in php..
Comment #4
tmsimont CreditAttribution: tmsimont commentedYa i re-read that and it's pretty intense haha - I definitely plan on posting the stand-alone. I'm hoping to do so soon, but i should warn that its a bit complex
Comment #5
hazah CreditAttribution: hazah commentedIs there a link yet? Chances are we could make use of it and contribute back based on use cases.
Comment #6
tmsimont CreditAttribution: tmsimont commentedI will try to put up a sandbox today, but it might not be ready until early next week
Comment #7
tmsimont CreditAttribution: tmsimont commentedin the mean time, you could create a simple module that uses hook_form_alter on your date-containing entity to look for a query string -- then the calendar td with a "single-day" class already has "data-date" attribute. You could use jQuery to write in a link to each td:
Comment #8
hazah CreditAttribution: hazah commentedI don't like query strings :). I'm sure a path would do fine. Thanks!
Comment #9
tmsimont CreditAttribution: tmsimont commentedok here it is:
http://drupal.org/sandbox/tmsimont/1917664
please take a look and let me know. i'd love some help with this thing.
Comment #10
hazah CreditAttribution: hazah commentedCool, will do.
Comment #11
adamtong CreditAttribution: adamtong commentedI also want the feature to click on calendar date to create events!!
Thank you!
Comment #12
tictac42 CreditAttribution: tictac42 commentedI am currently in dev, and trying to click events on my calendar to view nodes that I have already established (logged in as Admin). Is there a way to toggle between clicking the calendar to add events, and clicking the titles to view the nodes, I imagine somewhere in configuration? I am pretty new to Drupal...
thanks!
Comment #13
dmadruga CreditAttribution: dmadruga commented+1
Comment #14
Alcaparra CreditAttribution: Alcaparra commented+1
Comment #15
adityaj CreditAttribution: adityaj commentedvar link = "Add"; doesn't open the date content type with the date , it rather open "Add Content Page". Wonder where i am going wrong!
Comment #16
bleeuwen CreditAttribution: bleeuwen commentedIn addition to #7
(function($){
$(document).ready(function(){
$(".single-day").each(function() {
var date = $(this).data("date");
if (date) {
var link = "+";
$(this).append(link);}
});
});
})(jQuery)
Comment #17
Randeep.Singh CreditAttribution: Randeep.Singh commentedI am looking for this functionality. It is still under development. Is there any other way to achieve this functionality? if possible please provide information in this regard.
Comment #18
Neslee Canil Pinto