Event calendar with popups

After building an event calendar (see this page), you might want a balloon / popup / tooltip to appear when hovering over a date. This tooltip would display the node titles of all events on that date. This is not very straightforward to implement in Drupal. I puzzled for 2 days to get this done.

I have written a module for this to make this process easier. You can find it at http://drupal.org/project/calendar_tooltips. It requires beautytips.

If you would like to know how it works or how to do it manually, read on.

There are many tooltip modules for Drupal out there. I use beautytips. Download it and install it. For Explorer you also need to download excanvas_r3, and unzip it in a new directory excanvas_r3 in the sites/all/modules/beautytips/other_libs directory.

The content of a tooltip (the text appearing on the balloon) can come from:

  1. an HTML element's attribute, by default the title attribute
  2. the content of an HTML element
  3. another (external) HTML document.

We won't be using the first method, because I had trouble including HTML markup in the title attribute of an HTML element. The third method, referring to another HTML document, is cumbersome to implement. I went for the second method. Say, for example, we have a date 25 (like in december 25). Normally the following HTML code is produced:

<div class="month mini-day-on"><a href="...">25</a></div>

The class "mini-day-on" is added when there are events on that date. If there are no events on that date, then the class "mini-day-off" is added.

What we are trying to achieve is placing the following HTML code after the hyperlink "25":

<span style="display:none">Christmas day</span>

The text "Christmas day" will not display on the calendar (because of the "display:none" style), but later on when we are done, it should display on the tooltip when you hover over "25" on the calendar. When there are multiple events on that date, it may be useful to list the events in an unordered list. This will look something like this:

<span style="display:none"><ul><li>Christmas day</li><li>Richie's birthday</li></ul></span>

In order to tell Beautytips where to get the content we need to override the calendar module's calendar-mini.tpl.php. Copy sites/all/modules/calendar/theme/calendar-mini.tpl.php to your theme's directory. Add the following code at the beginnning of the month-view div:

   $bt_options['mini-calendar'] = array(
      "area" => ".mini-day-on a",
      "contentSelector" => '$(this).next().html()'

The area is a CSS selector that selects every hyperlink (eg. every date) on the mini calendar. The contentSelector is jQuery code which specifies the HTML code  of the hyperlink's first sibling (in our case the span element) as the tooltip's content.

Now we need to write some PHP code that produces the span element with the relevant event data. This is the difficult part. Look for the function called template_preprocess_calendar_datebox in sites/all/modules/calendar/theme/theme.inc. Copy this function to your theme's template.php. Replace the text "template" by the name of your theme. Insert the following code after this line:

$vars['class'] = 'mini-day-on';

Here is the code:

$bt_text = "<ul>";
foreach ($vars['items'][$date] as $time => $results_at_that_time)
   foreach ($results_at_that_time as $num => $result)
      $bt_text .= "<li>" . $result->raw->node_title . "</li>";
$bt_text .= "</ul>";
$bt_text = "<span style=\"display:none\">" . $bt_text . "</span>";
$vars['link'] = l($vars['day'], $vars['url']) . $bt_text;

What this does is aggregating all event data of that day and put it in an HTML unordered list, which is parented in a span element, which, on its turn, is placed next to the hyperlink.

That's it!

SEO Expert Singapore

Going to graduate school was a positive decision for me. I enjoyed the coursework, the presentations, the fellow students, and the professors. And since my company reimbursed 100% of the tuition, the only cost that I had to pay on my own was for books and supplies. Otherwise, I received a free master’s degree. All that I had to invest was my time. SEO Expert Singapore

Physics Tuition

You finished certain dependable focuses there. I did a hunt regarding the matter and discovered about all people will concur with your blog. Physics Tuition

Bridal shop singapore

I found Hubwit as a transparent s ite, a social hub which is a conglomerate of Buyers and Sellers who are ready to offer online digital consultancy at decent cost. Bridal shop singapore

voyance gratuite immediate par telephone

I have bookmarked your site since this site contains important data in it. I am truly content with articles quality and introduction. Much appreciated for keeping extraordinary stuff. I am particularly appreciative for this site. voyance gratuite immediate par telephone

voyance par tel

I most likely appreciating each and every bit of it. It is an incredible site and decent impart. I need to much obliged. Great employment! You all do an incredible blog, and have some extraordinary substance. Keep doing awesome. voyance par tel

Riga old town tour

wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated.Riga old town tour

local book event for

If you want you party to be a huge hit, hire a live band. The two influencing factors for deciding the type of live band to hire are your party type and your music preference. The various aspects and elements of hiring a live band are given at the website. local book event for

Printing Services Cheap Near You

Every one of you things considered have mind blowing stories. This is genuinely a striking examined for me.Printing Services Cheap Near You

dress shop

I have bookmarked your site since this site contains important data in it. I am truly content with articles quality and introduction. Much appreciated for keeping extraordinary stuff. I am particularly appreciative for this site. dress shop

Old town tours

Took me time to understand all of the comments, but I seriously enjoyed the write-up. It proved being really helpful to me and Im positive to all of the commenters right here! Its constantly nice when you can not only be informed, but also entertained! I am certain you had enjoyable writing this write-up. Old town tours

Unblocked Games at school

Amazing knowledge and I like to share this kind of information with my friends and hope they like it they why I do.. Unblocked Games at school


I hope the information we provide can be useful and be the best solution to solve your health problems. Kebutuhan Kalori Harian untuk Turunkan Berat Badan Penyebab Jerawat Tak Kunjung Sembuh Rutin Konsumsi Pisang Bisa Cegah Serangan Jantung

Cheapest International Courier

I have bookmarked your site since this site contains important data in it. I am truly content with articles quality and introduction. Much appreciated for keeping extraordinary stuff. I am particularly appreciative for this site. Cheapest International Courier

I want plenty of articles and

I want plenty of articles and blogs please upload shortly. saltwater pool maintenance

מסנן מים

The organization, which spends significant time in introducing water treatment frameworks מסנן מים

<a href="https://www.greenacresmowers.com.au/">briggs and stratt

This is an unprecedented energizing article.I am essentially happy with your awesome work.You put genuinely incredibly obliging information. Keep it up. Keep blogging. Planning to scrutinizing your next post.


VGlass est spécialisé dans la lunette utile pour la santé, notamment les lunettes de protection contre les lumières artificielles (entre autre la lumière bleue). ?Elles évitent à vos yeux de se fatiguer devant vos écrans (PC, tél., tablette,...) Nous avons par ailleurs crée les lunettes OphtaFit qui permettent de relaxer et rééduquer la vue et de garder des yeux en bonne santé. vglass.fr


Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. Questions to ask your girlfriend

Printing Services Cheap Near You

I at long last discovered extraordinary post here.I will get back here. I just added your blog to my bookmark destinations. thanks.Quality presents is the significant on welcome the guests to visit the website page, that is the thing that this page is giving.Printing Services Cheap Near You

Your site is truly cool and

Your site is truly cool and this is an awesome moving article. internet marketing service

Carpigiani Benelux

Opgericht in 1946 vestigde Carpigiani zich al snel tot marktleider in de productie van machines voor het maken van gastronomisch ijs, beter bekend als de Italiaanse stijl van ijs. In de jaren ’60 en ’70 de cultuur van het Italiaanse ijs verspreidde zich over de hele wereld, waarna het bedrijf ook zijn eerste overzeese vestiging opent. Daarnaast ontwikkelde het een verkoop netwerk met daarin exclusieve dealers, waaronder Ice Concepts Benelux, waarmee het snelle distributie, continuïteit en ondersteuning kan bieden aan de eindgebruiker. Carpigiani Benelux


minecraft skin stealer

It is ideal time to make a few arrangements for the future and the time has come to be cheerful. I've perused this post and on the off chance that I would I be able to want to propose you some intriguing things or recommendations. Maybe you could compose next articles alluding to this article. I need to peruse more things about it! minecraft skin stealer

Your article has provoked a

Your article has provoked a considerable measure of positive hobby. I can see why since you have made such a decent showing of making it fascinating. Colorado Springs Deck Repair

college plagiarism checker

Introduce me blogging indonesia want to visit on your website and read the contents of article useful for me, if any time please visit our website college plagiarism checker

Your writers are enormously

Your writers are enormously tremendous. blue ridge cabin rentals

Yacht Charters

Day Yacht Charter Boat Rentals, Yacht Charters, Boat Rentals, Boats Charter offers a extensive fleet of Yacht Charters and Boat Rentals as well as Mega Yachts. Our company has actively operated in the yacht rentals offering Affordable daily and week long charters Yacht Charters

voyance gratuite

All around the world, the future becomes unclear. Doubts and questions comes in our mind. To see clearly what will happen in your life, you can visit this website of french voyance gratuite, based in Paris, and call the 0892 22 20 33 to benefit of a voyance telephone with a fortune-teller, able to tell you what you need to know and give you the keys of success.

locksmith gloucester

locksmith company covering cheltenham and gloucester. safes, lock outs, Upvc door lock repair and lock replacement. locksmith gloucester

voyance audiotel pas cher

I am really getting a charge out of examining your richly created articles. No doubt you spend an impressive measure of effort and time on your blog. I have bookmarked it and I am reckoning examining new articles. Continue doing marvelous.voyance audiotel pas cher

band hire SoulDesire uk

Soul Desire is an eight piece soul band playing all of the classic soul hits of the 60s and 70s. Available for weddings, parties, corporate events in the south east of England. band hire SoulDesire uk

voyant par telephone

This is additionally a decent post which I truly appreciated perusing. It is few out of every odd day that I have the likelihood to see something like this..voyant par telephone

voyance telephone

A true voyance par telephone can permits you to discover your future through the veil of fate. Astrology, numerology and tarot cards are the tools of your fortune teller. The tradition of divinatory arts is still strong, even in these times. Your voyance telephone is waiting for your call at the 0892 22 20 22. See you.

Pest Control Cyprus Nicosia

Pest Control Cyprus Nicosia by pestcontrolcy.com will professionally super clean your home or work. They will effectively decontaminate your place removing any mice, rats or insects.


This is a decent tip especially to those new to the blogosphere. Basic however exceptionally precise information… Appreciate your sharing this one. An absolute necessity read post!Loģistika

living in laos

I am cheerful to locate your apparent structure for embellishment the post. After a short time you make it basic for me to comprehend and execute the idea. Grateful to you for the post. living in laos


Shop online at Pink Basis to find super cute clothes for Women at discount prices. Find over 8000 styles of shoes in stock and over 5000 dresses most of which sell for under $25. Looking for a new prom dress then check out the formal dress section for amazing gowns under $50. Pinkbasis

AMI Clubwear

AMIClubwear is famous for inventing the word clubwear and specializes in cheap celebrity fashion trends for under $20. Shop the latest and greatest celebrity style clothing for a fraction of the designer cost and twice the quality.AMI Clubwear

Transport company

Hello! This is my first visit to your blog! We are a group of volunteers and new activities in a similar specialty. Blog gave us valuable data to work. You have made a stunning showing with regards to!Transport company

Security Trier

Beim Qualitätsmanagement unserer Produkte legen wir höchste Maßstäbe an und garantieren ein faires Preis-­Leistungs­ Verhältnis. Das Spektrum, der uns möglichen Sicherheitsdienstleistungen ist sehr breit und muss an die persönlichen Bedürfnisse des Auftraggebers angepasst werden.Security Trier

Final Cut Pro X

From the center of the world to your editing station, editors can create brilliant beams of light in their scene with the Times Lights plugin from Brooklyn Effects(TM). Users can drag and drop the filter onto their footage in FCPX. Then, use the control points to customize the source and direction of the beams. Final Cut Pro X

social media marketing

Don’t Panik! is an award-winning, full-service, cleverly-hyphenated marketing agency located in sunny Carlsbad, California. social media marketing


This is exceptionally intriguing substance! I have altogether appreciated perusing your focuses and have arrived at the conclusion that you are ideal about a significant number of them. You are extraordinary. http://www.kay2.ca

pan card for nri

As per the rules laid in 2007 it is now mandatory for NRIs, PIOs, OCIs and foreign nationals who wish to do any sort of financial or investing related transactions in India. pan card for nri

james jack

Hi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job! wireless access point


Truly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found this one pretty fascinating and it should go into my collection. Very good work! http://eubookshop.com/

I discovered your this post

I discovered your this post while hunting down data about web journal related exploration ... It's a decent post .. continue posting and overhauling data. found here

james jack

I’m happy I located this blog! From time to time, students want to cognitive the keys of productive literary essays composing. Your first-class knowledge about this good post can become a proper basis for such people. nice one ico

Hoe maak je een banner

Charming point for a blog. I have been chasing the Internet down fun and stumbled upon your webpage. Glorious post. Thankful a ton for sharing your knowledge! It is unprecedented to see that a couple of individuals still put an effort into managing their locales. I'll try to return again honest to goodness soon.Hoe maak je een banner

good money lender in bugis

1st Credit SG Pte Ltd is a license money lender in Bugis, Singapore. Located in 149 Rochor Road #01-07 Fu Lu Shou Complex Singapore 188425, 1st Credit SG Pte Ltd has help many people to get the cash they needed quickly. They are open every day including weekends and provide loans to everyone in Singapore. Contact them at +65 6266 5422 if you have questions for them. good money lender in bugis