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.
My custom module doesn't work. I need help.
I try to have dayClick option like in fullcalendar documentation -> javascript API
fullcalendar_yoh.info
name = fullcalendar yoh
description = Module perso de Yoh
core = 7.x
package = FullCalendar
dependencies[] = fullcalendar
fullcalendar_yoh.module
<?php
/**
* Implements hook_preprocess_views_view().
*/
function fullcalendar_yoh_preprocess_views_view(&$variables, $hook) {
if ($variables['view']->display_handler->get_option('style_plugin') == 'fullcalendar') {
drupal_add_js(drupal_get_path('module', 'fullcalendar_yoh') . '/js/fullcalendar_yoh.js');
}
}
js/fullcalendar_yoh.js
(function($) {
Drupal.fullcalendar.plugins.fullcalendar_yoh = {
options: function (fullcalendar) {
var options = {
dayClick: function(date, allDay, jsEvent, view) {
$('.fullcalendar')
.fullCalendar('gotoDate',date)
.fullCalendar('changeView','basicDay');
}
};
return options;
}
};
}(jQuery));
If i change Drupal.fullcalendar.plugins.fullcalendar_yoh to Drupal.fullcalendar.plugins.fullcalendar_option or Drupal.fullcalendar.plugins.fullcalendar in my js file, dayClick works but fullcalendar params or fullcalendar options modules params are overwriting.
Comments
Comment #1
tim.plunkettThe documentation somehow got out of date, sorry about that.
Your .info file is fine, here is the new .module file:
The JS file should be js/fullcalendar_yoh.fullcalendar.js, and there is one small change:
Note the
$('.fullcalendar', fullcalendar.$calendar)
, the added part ensures that the change is made to the correct calendar if there are more than one per page. However, if you want a click on one to change both, use your original code.Comment #2
yooh CreditAttribution: yooh commentedThanks a lot, it's working.
Now, i can try more difficult :)
See you later!
Comment #3
aspilicious CreditAttribution: aspilicious commentedhttp://drupal.org/node/1342772