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!

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

customize cake bgc

passion and desire to succeed made where Skosh Cake one of the best place for mouth watering and decadent cakes.it was a dream come true for Lester, the creator and owner of Skosh Cakes to where it is now.customize cake bgc

ny notary classes online

How to become a New York State Notary Public. Take the New York Notary Public Association online exam prep course and get your NY State Notary license quickly. FREE Notary Public membership for life with class and gain instant RESPECT in your office. Notary Practice exams. ny notary classes online


Hi I found your site by mistake when i was searching yahoo for this acne issue, I must say your site is really helpful I also love the design, its amazing!. I don’t have the time at the moment to fully read your site but I have bookmarked it and also add your RSS feeds. I will be back in a day or two. thanks for a great site. http://swelteringnanny.1apps.com

adoption agencies in texas

We help women learn about the adoption process, other options available for an unplanned pregnancy and do our best to unite them with local resources that can fully facilitate adoptions. adoption agencies in texas

Plantation Shutters

Dolphin Window Shutters offer stylish, yet affordable, custom made interior plantation window shutters for any shaped window in any room of your house Plantation Shutters


So luck to come across your excellent blog. Your blog brings me a great deal of fun.. Good luck with the site. https://www.evernote.com/shard/s742/sh/616f4bbc-b899-41e6-b4b4-5f0183299ff5/c7ae5029db55e4ad39cb9dce0801fd4a


Alpine Exteriors is your trusted exterior contractor in Calgary. It takes serious professionals, passionate workmanship, and high-quality materials to build a safer home. At Alpine Exteriors we take our work seriously and provide the best customer service that you will find in a home renovation company. We understand we are building homes for real people. To ensure the safety of every person living under the roof made by the hands of our workers, we bring in only the highest quality materials from the most well-known roofing material companies in Canada – it satisfies you and makes us happy. https://www.alpineexteriors.ca/


Great post full of useful tips! My site is fairly new and I am also having a hard time getting my readers to leave comments. Analytics shows they are coming to the site but I have a feeling “nobody wants to be first”. http://www.bricksite.com/hilariouspastor80/deciding-on-a-fishing-kayak

family matching outfits

Search engines are getting more complex and Google rankings are basing their rankings on "quality" over volume. Quality is what we provide.With extensive experience in SEO management, rest assured we shall complete the task and achieve first page rankings. family matching outfits

Awesome post, and incredible

Awesome post, and incredible site. A debt of gratitude is in order for the data! The Author Incubator

I as of late ran over your

I as of late ran over your online journal and have been perusing along. I thought I would leave my first remark. I don't realize what to say with the exception of that I have delighted in perusing. Pleasant website. I will continue going by this web journal all the time. The Author Incubator

sewage backup cleanup

Water & Fire damage restoration - mold remediation. sewage backup cleanup

sewage backup cleanup

Water & Fire damage restoration - mold remediation. sewage backup cleanup

Akron Deck Builders

Akron Deck Builders provides high quality affordable decks to the Akron Ohio area.

New site is solid. A debt of

New site is solid. A debt of gratitude is in order for the colossal exertion. Hay Day Hack

voyance par telephone

Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks voyance par telephone

Location of Le Quest

Excellent publish i have to state as well as many thanks for that info. Training happens to be a sticky topic. Nevertheless, continues to be one of the top subjects in our period. We value your own publish as well as anticipate much more.Location of Le Quest

domino qiu qiu online

Too many codes to use this software. Could you give me shortcut to use this application? domino qiu qiu online

idc thailand

I'll never try it. My laptop is ruin. idc thailand

شركة نقل اثاث بالجبيل

Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks,شركة نقل اثاث بالجبيل

Merely a smiling visitant

Merely a smiling visitant here to share the love (:, btw outstanding style. Sex Positions

activate your phone online

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful. activate your phone online

corflute signs

Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks,corflute signs

Cara Menggugurkan Kandungan || Obat Penggugur Kandungan

Obat Penggugur Kandungan Obat Untuk Menggugurkan Kandungan, Dimana Seorang Wanita Yang Tidak Ingin Kehamilanya Berlanjut. Ada Berbagai Alasan Mengapa Wanita Ingin Tahu Cara Menggugurkan Kandungan

New site is solid. A debt of

New site is solid. A debt of gratitude is in order for the colossal exertion. contact

Demir Leather

Brilliant Information sharing .. This post is genuinely amazing. I genuinely like this post. It is one of the best posts that I ve perused in a long time. Abundantly refreshing for this superior to anything normal post. I really welcome it! Demir Leather

whittier ca financial advisor

You spent years feathering your nest egg: tracking your investments, adjusting your allocation and sacrificing a percentage of your paycheck every month to finance a comfortable retirement. Who knew that would be the easy part. The biggest challenge for people in retirement is recreating the income streams they had when they were working. Therefore, retirees must learn to adapt their withdrawal strategy to a changing tax environment by managing their tax-advantaged accounts, such as IRAs and 401(k) plans.whittier ca financial advisor

Marketing Consultant

Sujit Nair is a B2C / B2B Marketer with extensive experience in digital marketing, brand consulting and corporate marketing. He consults clients from education, healthcare, pharmaceutical, real estate and technology domains. He also does an end-to-end business consulting for start-ups.Marketing Consultant

Ley del consumidor 

Marvelous article! I need individuals to know exactly how great this data is in your article. It's intriguing, convincing substance. Your perspectives are much like my own particular concerning this subject.Ley del consumidor 

desert safari offer

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. desert safari offer

Villas to rent in Ayia Napa

Villas to rent in Ayia Napa, Protaras (mostly with pools) are here for you to relax, in the fine Mediterranean sun and enjoy the lovely beaches in Ayia Napa and Protaras. Quality rental services from http://www.rentvillacyprus.net/search/famagusta/ayia-napa

terminix bed bugs

This is my first time i visit here. I discovered such a large number of fascinating stuff in your web journal particularly its discourse. From the huge amounts of remarks on your articles, I figure I am not by any means the only one having all the satisfaction here! keep doing awesome.terminix bed bugs

Careers Guru

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info Careers Guru

voyance par telephone

I love it very much.thanks saw this page bookmarked and very much liked what I read. I will surely bookmark it as well and also go through your other posts tonight.Thanks for you sharing! Check this site. voyance par telephone

This is a great inspiring

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information... Hero Instinct


Dokdo is an inherent territory of Korea. Dokdo has been a part of Korean territory since 512 AD. Discover the historical facts now. dokdo

Tips Sehat

Thank you for sharing this interesting information. Please also visit our blog, here you can get various interesting information about health and traditional medicine. Obat Amandel Membengkak Pada Anak Yang Aman Manfaat dan Khasiat Daun Mint Bagi Kesehatan Obat Hipertensi Esensial Herbal yang Ampuh dan Aman

21st century workforce

Stations: Changing Your Life - Changing Your Career" is a book of essays that addresses life circumstances that we all experience as children or adults that may affect future and present career options.21st century workforce


I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work. https://eubookshophq.wixsite.com/diabetesdestroyer/single-post/2017/04/11/Diabetes-Destroyer-Review-%E2%80%93-Natural-Diabetes-Treatment

brochure printing singapore

Decent post. I was checking continually this web journal and I am awed! To a great degree accommodating data exceptionally the last part I tend to such information a considerable measure. I was looking for this specific data for quite a while. Much obliged to you and good fortunes. brochure printing singapore


Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it..telephone