Planet Drupal

Syndicate content
drupal.org - aggregated feeds in category Drupal Planet
Updated: 15 min 25 sec ago

Web Wash: Customize Media Module Image Display in Drupal 7

Tue, 26/03/2013 - 5:50pm

The Media module has really become the de facto standard in handling media files in Drupal 7. I really like the concept of having files (images, videos, etc) as entities. When a file is an entity, you can attach custom fields and modify how the file is displayed by customizing specific view modes.

When you install the Media module for the first time it can be intimidating because there are a lot of moving parts. But if you already have an understanding of how entities, fields and view modes work in Drupal you will get the hang of it pretty quickly.

Categories: Drupal News

Code Karate: Drupal 7 Floating Block Module

Tue, 26/03/2013 - 2:56pm
Episode Number:  131 Post Topics:  Drupal Blocks Contrib Drupal 7 Layout Tools Drupal Planet UI/Design Javascript JQuery

The Drupal 7 Floating Block module makes it easy to float a Drupal block along the sidebar as you scroll down the page. It uses a simple CSS selector to determine which blocks to float.

In this episode you will learn:

  • How to install and configure the Drupal 7 Floating Block module
  • How to determine the CSS selector to use for your block
  • How to get a Drupal block to float as you scroll down the page
DDoD Video: 

read more

Categories: Drupal News

Expresstut: Setting up jquery masonry on your drupal website

Tue, 26/03/2013 - 11:22am

In this screencast we would be learning how to set up the masonry module on a drupal website. Jquery mansory is a dynamic layout plugin for jquery. With this plugin you can achieve a responsive design close to something like pintrest. The creator of masonry David DeSandro describes this plugin as "The flip-side of CSS floats". In other to achieve the desired result, we made use of two modules

1) Masonry Module http://drupal.org/project/masonry

2) Views infinte scroll  http://drupal.org/project/views_infinite_scroll

Here is a tutorial on how to setup the views infinte scroll module in drupal.   Tutorial

 

To follow this tutorial, it is assumed you have some knowledge of how to use the views module in drupal. 

There was a bug with the masonry module not working with the views infinte scroll module. to solve/fix this issue, here is a link where I got the patches 

http://drupal.org/node/1808018

Get the patch on #3 and #4 and everything should work fine.

Categories: Drupal News

PreviousNext: Nine front-end tools, techniques, and practices for Drupal themers

Tue, 26/03/2013 - 8:04am

It is easy to be overwhelmed with all of the newest front-end tools out there. Below are nine tools and techniques that the themer crew at PreviousNext are using to make our lives easier.

Categories: Drupal News

Lullabot: Module Monday: AutoFloat

Tue, 26/03/2013 - 8:00am

Try as you might to stop it, sometimes it's inevitable. Content editors, RSS import scripts, and other tools result in a designer's nightmare: raw images unceremoniously dropped in node bodies. They clump over to the left, break up the flow of text, force editors to manually tweak the markup of the guilty nodes to keep things looking good. Thankfully, there's a solution for Drupal 7: AutoFloat.

Autofloat is a simple input filter that can be added to any Input Format on a Drupal site, like Full HTML or Filtered HTML. It scours the filtered markup for image tags, adding extra CSS classes that float them, alternating left and right to keep the layout from getting stale.

Autofloat can also be configured to do its processing but leave out the custom CSS rules, add extra classes to the images it detects, or ignore images that already have custom CSS classes assigned. The result is a handy tool that can prep manually-inserted images for your own custom CSS, without its own styles getting in the way.

Categories: Drupal News

Drupal Easy: Arbitrary "OR" SQL Queries

Tue, 26/03/2013 - 5:18am

I was working on a Drupal migration project today using the Migrate module where I needed to import only select user roles from the source (Drupal 6) database.

The Migrate module allows for a custom query to select only the user roles that need to be imported. In my case, the two roles I wanted to import had role IDs of 4 and 6. So, how do I write a query using the Drupal Database API to do this? Turns out there's a pretty elegant answer. Rather than writing something like:

-->

read more

Categories: Drupal News

Phase2: Implementing BASSTrakk Maps on Bassmaster.com

Tue, 26/03/2013 - 4:29am

We recently implemented a new feature on top of BASSTrakk, (provided by B.A.S.S, BASSmaster.com) that maps out the location of all angler’s positions and catches on the lake during a tournament.  The underlying goal of this new feature is to further engage spectators in the sport of bass fishing and provide additional coverage and statistics beyond what can be acquired through typical televised coverage.

To achieve this, we needed a solution that is performant under heavy traffic, provides rich interactivity with the data gathered from the tournament, and is also highly maintainable for future enhancements and adjustments.   The success of this solution would depend on choosing the right map vendor.

Choosing a vendor to fuel pieces of functionality on your site is kind of like marriage.  It is a very difficult decision, and once you say yes, it is often very hard to get out.  While some features are relatively simple to swap out without too much sweat (e.g. traffic tracking services like Google Analytics and Chartbeats), other vendors require a huge game plan if you need to switch over to a competitor.

Map vendors provide their own unique API interface to allow developers to use their map layers and plot markers, labels, shapes and other objects on the page elegantly without too much custom work.  However, the problem I saw with this is that, when it comes time to migrate to another source, you will also have to convert the code you custom-tailored to that vendor, as well, making the transition expensive.  If there’s a chance that the vendor experiences downtime or fails at some point in the future, you’ll be forced to make the transition whether you have the time and resources when it happens.

OpenLayers to the Rescue

Enter OpenLayers, a client-side, open source javascript library with a rich API for displaying maps using various map sources.  This project has been around for over six years, and is still actively maintained to stay compatible with most map vendors, including Mapquest, Yahoo!, Bing, and Google Maps.  In addition to its elegant ability to switch map sources on the fly, it also has a rich set of mapping tools at your disposal.  Since the project is open source and can be easily hosted on your server, it’s also very easy to extend the core code to add your own functionality.

OpenLayers itself does not provide the map tiles.  It is more of an abstraction layer that adds functionality to map tiles.  Regardless of what source you use, you still have to load libraries provided by the map vendors.  Beyond that, there is no need to refer to their API to add markers, lines, objects, and more on the map as such functionality can be developed broadly across all sources within OpenLayers.

 

Mapbox for High Traffic Loads and Beautifying Map Tiles

For this project, we decided to use Mapbox (developed by Development Seed) to provide custom-designed maps to the end user, even under heavy traffic.  Some custom development may be done in Mapbox (e.g. removing labels on the map, changing the texture and colors of map objects) within the account. 

However, the major advantage Mapbox has over most other vendors is that it allows developers to design the map however they would like (want to make the water purple?  Remove all lakes and ponds from the map?  Change the font of the labels?).  This can be done using TileMill, an application that lets you design your layers locally.  You can use your creation in TileMill to serve maps within your Mapbox account.

The End Result?

The map was presented to spectators during the BASSmaster Classics, the sport’s biggest event of the year.  Despite competitor’s concerns over the new feature, public engagement in the sport increased dramatically.  The new feature allowed spectators away from the event to locate their star angler’s current location as well as the location of the catches versus their competitors.  This is more coverage than what BASSTrakk previously provided, which was a consolidated count of each angler’s fish count.

Mapbox held up to serving over a million map views every day during the tournament without failure.  That, and the ability to modify the map layers easily during the final stages of the project gave us bandwidth to focus on more important features rather than going through third party documentation and potentially having to contact the map vendors themselves for a solution.  Taking the time to find the right map vendor for our project was well worth

For a demo, be on the lookout for the next major fishing tournament covered by bassmaster.com.

 

Categories: Drupal News

Drupal.org Featured Case Studies: Top7news

Tue, 26/03/2013 - 3:48am
Completed Drupal site or project URL:  http://www.top7news.gr

Top7news is a news aggregator that operates automatically by gathering and archiving the RSS feeds from several Greek news sites, providing a functional and easily accessible front end for the user to read through the latest news.

Categories: Drupal News

Károly Négyesi: We need better modules

Tue, 26/03/2013 - 3:37am

The database is there, it has values, surely they are the values that needs to appear. Hooks, controller classes and the like are just slowing you down, why use them? I do not even know why we even bother with Drupal 8 if this mindset is still prevalent.

Categories: Drupal News

Tim Millwood: Drupal's not the only option

Tue, 26/03/2013 - 1:15am

Last week Phase2 launched their new site and blogged about it. As a company that is mainly focussed on Drupal, they made sure to add few paragraphs on the fact that their new site is not Drupal, and that they decided to use Wordpress.

Read the full post on Millwood Online

Categories: Drupal News

Acquia: Protecting Drupal's fleshy underbelly with .htaccess

Tue, 26/03/2013 - 12:39am

In this article, I’m going to show you a few methods to separate your public site from the vulnerable parts of your administration area. What you need is an effective way to keep your site locked and secure, and protected from attacks, while still leaving your site editable for trusted users.

Categories: Drupal News

The Module Off: Views Plugin Challenge is Complete

Tue, 26/03/2013 - 12:21am

Our Views plugin challenge has just finished, and we got some great submissions for you to check out.

The Challenge

Thank the good lord for Views (which is now in Drupal core!). If it wasn't for Views, we'd be writing custom queries to list data all the time. Sometimes, though, Views doesn't do exactly what you need it to do, and when that happens you'll have to create either a handler or a plugin. Views has 10 different types of plugins! For this challenge, you pick any type you want, and create something useful. The submission that does something useful and is well explained in a screencast / text gets the win. Get crackin'

The Winner

We had a few great submissions, but Mike Miles submitted an excellent module and accompanied it with an excellent description / screencast, which is why he's taking home our prize. Mike created an access plugin for views that uses a taxonomy reference on the user to control whether the user can see a view. His code and explanatory screencast are definitely worth checking out. There are two other great submissions that you can learn from as well. Mike earned himself a free year of hosting from DreamHost. Congrats!

Here's Mike's screencast so you can see the module in action:

Coming Up: Drush!

Our next contest calls for submissions with examples of Drush craziness. We want to see cool Drush integration for existing modules, new global drush commands, or even helpful drush scripts that you use in your workflow. Check it out!

Tags: Drupal Planet
Categories: Drupal News

flink: My first D7 -> D8 module port

Mon, 25/03/2013 - 11:30pm

I've just ported one of my D7 modules, Views Contextual Range Filter, to D8. Phew! That took longer than I'd hoped.

In terms of the effort, I'm not referring to us developers having to convert our .info files to .info.yml files. Or that for configuration variables our trusty mymodule_settings() function now needs to return system_config_form($form, $form_state) and that we have to do the saving of our config variables ourselves in another function, using the new API that came out of the CM initiative.
Those were the obvious and the easy bits.

I'm talking Views.

At the time of writing, nothing in this lovely porting tutorial prepares a developer for what they'll face when they port a D7 module that interacts in a big way with Drupal's biggest module, Views.

Views, blocks and the config stuff have plunged deeper into OO through Symfony.

If you're an ex-Java developer like me, then for Symfony read Spring (dependency injection, annotations etc) and you should be right… after the initial shock ... And after a few days of poking, trying to figure things out and reworking your code.

If you only know enough OO to get by in D7, then brace yourself for a brush-up. Big time. Expect to see more of the :: symbol and of that function return chaining thingy (->) so popular in Ruby. If you don't know what I'm talking about, then you're getting my point exactly.

With CTools gone and Views Symfonised, we're not just talking symbols and name changes here. Most of your D7 Views code will be broken: your handlers, plugins, argument code… pretty much everything… Some D7 hooks are gone. Some View data publicly available in D7 is now protected, so new access functions are required to get to it and manipulate it.

Finding where to start can be a daunting task in itself. Your D7 class views/handler/views_handler_argument_numeric.inc for instance, looks and feels different and lives in core/modules/views/lib/Drupal/views/Plugin/views/argument/Numeric.php. Makes sense? Not to me either. Not at first.

With their Symfonication, the new Views parts have also adopted CamelCase notation rather than lowercase plus underscores. Yep… We now have double coding-standards. What is the Coder module going to recommend, I wonder?

The good news? Revisiting your old code is an opportunity to get it right the second time. And Symfony is cool.
So, coming out at the other end of that tunnel, your code does shine a little brighter. Cleaner. And ready to take on the future.

Rik

File under:  Planet Drupal
Categories: Drupal News

TimOnWeb.com: Now You Can Create Personal Lists of Drupal Snippets at Dropbucket

Mon, 25/03/2013 - 10:35pm

Yes, you read it right! Now you can create personal lists of Drupal snippets at Dropbucket.org - Drupal snippets repository. It turned out that we already have loads of great snippets at the website and there challenge have appeared: how to group these snippets in some convenient way? So for example, you found five cool snippets about theming and you could add them to your bookmarks, but later, you can lose track of them because you're constantly adding other snippets to your bookmarks and sooner or later you can simply get lost in your bookmarks feed.

Read on about Now You Can Create Personal Lists of Drupal Snippets at Dropbucket
Categories: Drupal News

Web Omelette: Interview with Chris Weber, creator of the Drupal community on Google+

Mon, 25/03/2013 - 9:30pm

This is a written interview with G+ Drupal community creator Chris Weber. I wanted to ask him a few questions about this awesome thing the Drupal community now has, but also about the man behind it.

Categories: Drupal News

Singlebrook Technology: Creating Custom Beans in Drupal, Part 1

Mon, 25/03/2013 - 6:15pm

by Aaron Froehlich

*Feel free to browse the code from this tutorial in my sandbox repository at Drupal.org.

This tutorial is a follow-up to a recent article on Minimalist Drupal Development, where I made the case for judicious module selection as a strategy for keeping Drupal sites more performant and enjoyable to code. In this tutorial, I'll demonstrate how to create a Twitter timeline block using the Bean API. Ironically, a similar module appeared recently, called "Twitter Timeline" and released by Tom Kirkpatrick. The main difference here is that this solution relies on Drupal's cache and our own custom output rather than Twitter's widget system....

Categories: Drupal News

comm-press | Drupal in Hamburg: New contributors to Drupal 8 need to install Drupal 8? No... and Yes.

Mon, 25/03/2013 - 3:54pm

New contributors to Drupal 8 do not need to have a local development environment running Drupal 8 in order to contribute.

Options for contributing without running Drupal 8 locally: But then you get a taste of contributing and Drupal 8 and you want to run it locally.

I really want to compile other blog posts and documentation pages on running Drupal 8 locally. For now, here are a few pieces of information that will be helpful.

  • The drupal.org doc page for Setting up a test environment to review patches is a pretty good place to start.
  • Minimum php 5.3.10 is needed.
  • [edit: I have fallen prey to the must be 5.3 fallacy. 5.4 is fine. We can just use that. Thanks Berdir!] On MAMP (not MAMP pro) you might see only 5.2 and 5.4. To be able to select 5.3, go to the applications directory for MAMP, and rename the php 5.2 directory to something else. Then the radio button to select 5.3 will show in the MAMP UI.
  • I up the resource limits in my php.ini for max_execution_time, max_input_time, and memory_limit.
  • I find setting up drush to work forces me to also set magic quotes to Off in my php.ini magic_quotes_sybase, magic_quotes_runtime, magic_quotes_gpc.
  • I like to get drush with git clone on the highest branch, since changes to drush are frequent to keep up with making it work with Drupal 8.
  • Starting over with a super clean Drupal 8 env is going to mean removing the active config and dropping the database tables.

If you search around and try a few things, but run into trouble getting Drupal 8 to install on your local system, or you install fine, but test do not pass locally, then open an issue and tag it "d8 dev environment".

Weiterlesen

Categories: Drupal News

Expresstut: Installing and configuring the IMCE Wysiwyg bridge module

Mon, 25/03/2013 - 11:04am

In this screencast, we would learn how to install and configure the imce-wysiwyg bridge module.

What is the advantage of this module? Say for example you are making use of the WYSIWYG module on your drupal site, you find out it is diffuclt adding an image to your content if you are not an experienced drupal user, since this requires using the correct url. With the imce wysiwyg module, you can simply browse files on your server or uplaoding a new file using a dialog and then selecting what file you would like to upload/use in your content. This is an easier and better way of adding images to your content especially if your drupal site user in a novice at using drupal.

http://drupal.org/project/imce_wysiwyg

This tutorial assumes you already have the knowledge of how to install and configure the WYSIWYG module. In case you do not know how to, here is a link for doing that. http://www.expresstut.com/content/using-wysiwyg-drupal

 

 

 

Categories: Drupal News

Zero to Drupal: Creating a Calendar without using Views

Sun, 24/03/2013 - 3:44pm

Recently I needed to create a calendar view of nodes that had a date field (with start/end dates). After researching my options, I came to the conclusion that I had the following choices:

  1. Use the Views-based Calendar module to create a page with the proper query
  2. Try to code a calendar view from scratch
  3. Use a jQuery calendar plugin and integrate with Drupal.

The first option looked promising but I quickly found that it didn't quite fit my needs. The calendar needed to be able to show nodes of different types (events/tasks that also used different fields for their dates) and this was simply not possible using Views (could be wrong but I doubt it).

The second option offered more flexibility but also meant I'd have to build/theme a calendar from scratch and honestly, who wants to do that?

In the end, I went with the third option which allowed me to build the query how I needed while relying on the handiwork of a jQuery plugin to make it pretty. I decided to use Adam Shaw's excellent FullCalendar jQuery plugin since it's dead simple to use and offers a myriad of options to help suit your needs.

Here's a basic overview of how I got things set up.

Installing the FullCalendar plugin

First, I downloaded the FullCalendar module and placed it in my "sites/all/libraries" directory. The great thing about Drupal is that you really don't need to do much to get jQuery plugins working on your site. To make things easy, I used hook_library() to define the default javascript & css files that need to be added like so:

  1. /**
  2.  * Implements hook_library().
  3.  */
  4. function mymodule_library() {
  5. if($fc_path = libraries_get_path('fullcalendar-1.5.4')) {
  6. $items['fullcalendar'] = array(
  7. 'title' => 'FullCalendar',
  8. 'version' => '1.5.4',
  9. 'js' => array(
  10. $fc_path . '/fullcalendar/fullcalendar.min.js' => array(),
  11. ),
  12. 'css' => array(
  13. $fc_path . '/fullcalendar/fullcalendar.css' => array(),
  14. ),
  15. 'dependencies' => array(
  16. array('system', 'ui'),
  17. array('system', 'ui.draggable'),
  18. array('system', 'drupal.ajax'),
  19. array('system', 'jquery.form'),
  20. ),
  21. );
  22. }
  23. }
Querying the data & showing the calendar

Next, in my custom module I created two page callbacks (one to display the calendar, the other to be an ajax callback that FullCalendar uses to populate events.

  1. $items['node/%node/calendar'] = array(
  2. 'title' => 'Calendar',
  3. 'page callback' => 'mymodule_calendar_page',
  4. 'page arguments' => array(1),
  5. 'access callback' => 'mymodule_menu_access_callback',
  6. 'access arguments' => array(1, 'access content'),
  7. 'file' => 'mymodule.pages.calendar.inc',
  8. 'type' => MENU_LOCAL_TASK,
  9. );
  10. $items['ajax/mymodule/calendar/%node/events'] = array(
  11. 'page callback' => 'mymodule_ajax_calendar_events',
  12. 'page arguments' => array(3),
  13. 'access arguments' => array('access content'),
  14. 'file' => 'mymodule.pages.calendar.inc',
  15. );

In the first callback, I simply return a div with an id that I can target in the javascript. It should be noted that in my module, I used a $settings array to pass any needed data to Drupal.settings so that I have access to that data in javascript. This keeps you from hardcoding things like the selector in your javascript file. You'll also note that I use the #attached FAPI property to include the library we created above, and attach any other javascript files/settings.

  1. /**
  2.  * Returns markup for calendar page.
  3.  */
  4. function mymodule_calendar_page() {
  5. $selector = 'mymodule_calendar_div';
  6.  
  7. $settings = array(
  8. //set any custom settings that you need to access in javascript here
  9. );
  10.  
  11. $output['calendar'] = array(
  12. '#markup' => '<div id="' . $selector . '"></div>',
  13. '#attached' => array(
  14. 'library' => array(
  15. array('mymodule', 'fullcalendar'),
  16. ),
  17. 'js' => array(
  18. $path . '/js/mymodule.calendar.js' => array(),
  19. array('data' => $settings, 'type' => 'setting'),
  20. ),
  21. ),
  22. );
  23.  
  24. return $output;
  25.  
  26. }

In the second callback I use EntityFieldQuery to get the data I need, then return the data for each event/task. Note, I'm pasting the code directly from my module as-is for reference but you'll need to adapt what I've done for your own needs.

  1. /**
  2.  * Ajax callback to return project events.
  3.  */
  4. function mhm_project_ajax_calendar_events($project) {
  5. drupal_add_library('system', 'drupal.ajax');
  6. $events = array();
  7.  
  8. $og = og_get_group('node', $project->nid);
  9.  
  10. $start = (int) $_GET['start'];
  11. $end = (int) $_GET['end'];
  12.  
  13. // This is a separate function that gets events for this date range.
  14. $result = mhm_project_get_project_events($og->gid, $start, $end);
  15.  
  16. if(module_exists('mhm_og_tasks')) {
  17. // Get tasks for this project.
  18. $query = new EntityFieldQuery();
  19. $query
  20. ->entityCondition('entity_type', 'node')
  21. ->propertyCondition('type', array('task'), 'IN')
  22. ->propertyCondition('status', 1)
  23. ->fieldCondition('group_audience', 'gid', $og->gid)
  24. ->fieldCondition('field_due_date', 'value', array($start, $end), 'BETWEEN');
  25. if($tasks = $query->execute()) {
  26. $result = array_merge($result, $tasks['node']);
  27. }
  28. }
  29.  
  30. foreach($result as $row) {
  31. $node = entity_metadata_wrapper('node', $row->nid);
  32. $entity_uri = entity_uri('node', $node->value());
  33.  
  34. $event = (object) array(
  35. 'id' => $node->nid->value(),
  36. 'title' => $node->title->value(),
  37. 'url' => url($entity_uri['path'], $entity_uri['options']),
  38. 'event_type' => $node->type->value(),
  39. );
  40.  
  41. switch($node->type->value()) {
  42. case 'event':
  43. $event->start = $node->field_date->value->value();
  44. $event->project_team = $node->field_project_team[0]->value();
  45. if($node->field_project_team->value()) {
  46. $event->color = $node->field_project_team[0]->field_color->value();
  47. $event->className = 'project-team-' . $node->field_project_team[0]->nid->value();
  48. }
  49.  
  50. if($node->field_date->value->value() != $node->field_date->value2->value()) {
  51. $event->end = $node->field_date->value2->value();
  52. }
  53. break;
  54. case 'task':
  55. $form = drupal_get_form('mhm_og_tasks_task_completion_form', $node->value());
  56. $form['task']['#title'] = $form['#task']->title;
  57. $form['task']['#suffix'] = NULL;
  58. $event->task_form = drupal_render($form);
  59. $event->start = $node->field_due_date->value();
  60. $event->className = 'mhm-project-task';
  61. $event->color = '#FFF';
  62. $event->textColor = '#000';
  63. break;
  64. }
  65.  
  66. if($body = $node->body->value()) {
  67. $event->description = $node->body->value->value(array('sanatize' => TRUE));
  68. }
  69.  
  70. $events[] = $event;
  71.  
  72. }
  73. echo drupal_json_encode($events);
  74.  
  75. drupal_exit();
  76. }

Basically, this function gets both the events and tasks for the given date range, loops through the results and builds the object needed for FullCalendar to use, then returns the results as a json-encoded array. There's a lot that I could cover in this function (like the use of the Entity module to get values from a node, but that's for another post.

The FullCalendar javascript

Lastly, I created a javascript file that initializes the fullCalendar object and calls the ajax callback page to get the events for the displayed month. As with the ajax function above, I'm also posting the javascript file as is for reference. I used the fullCalendar documentation to help with setup but all in all, it was pretty easy to set up and get going.

  1. (function($) {
  2. Drupal.behaviors.mymodule_calendar = {
  3. attach: function(context, settings) {
  4. $("a.fc-event").popover({
  5. trigger: "hover",
  6. });
  7.  
  8. $(settings.mymodule.calendar.calendar_selector).fullCalendar({
  9.  
  10. events: {
  11. url: settings.basePath + settings.mymodule.calendar.project_events_json_url.replace("%nid", settings.mymodule.calendar.project.nid),
  12. },
  13.  
  14. dayClick: function(date, allDay, jsEvent, view) {
  15. var frag = "?gids_node[0]=" + settings.mymodule.calendar.project.nid;
  16. var d = new Date(date);
  17. frag += "&field_date_value=" + d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate();
  18. Drupal.overlay.open("#overlay=node/add/event" + escape(frag));
  19. },
  20.  
  21. eventRender: function(event, element) {
  22. // Since we always return events for all project teams, check
  23. // to see if this event's team is currently hidden. If so, hide
  24. // this event.
  25. switch(event.event_type) {
  26. case 'event':
  27. if(event.project_team != null) {
  28. if(settings.mymodule.calendar.teams[event.project_team.nid] == null) {
  29. element.hide();
  30. }
  31. }
  32. break;
  33. case 'task':
  34. if(settings.mymodulecalendar.teams['task'] == null) {
  35. element.hide();
  36. }
  37. break;
  38.  
  39. }
  40. if(event.task_form != null) {
  41. element.find('span.fc-event-title').html(event.task_form);
  42. }
  43.  
  44. element.tooltip({
  45. title: element.description,
  46. });
  47. }
  48. });
  49.  
  50. // Allows clicking legend items to hide/show coresponding events.
  51. $("ul.mymodule-project-team-legend span.swatch").click(function() {
  52. switch($(this).attr("data-legend-type")) {
  53. case 'project-team':
  54. var team_id = $(this).attr("data-mymodule-team-id");
  55. $("a.project-team-" + team_id).toggle();
  56. break;
  57. case 'task':
  58. var team_id = "task";
  59. $("a.mymodule-task").toggle();
  60. break;
  61. }
  62.  
  63. if($("i", this).hasClass("icon-ok")) {
  64. settings.mymodule.calendar.teams[team_id] = null;
  65. } else {
  66. settings.mymodule.calendar.teams[team_id] = team_id;
  67. }
  68. $("i", this).toggleClass("icon-ok");
  69. });
  70. }
  71. }
  72. })(jQuery);
Conclusion

All in all, the combination of EntityFieldQuery, the fullCalendar jQuery plugin, and a little bit of putting it all together made it rather easy to accomplish what I was after. I hope this helps to show how easy Drupal 7 makes it to do things like this. Feel free to leave a comment with any questions or suggestions.

Until next time!

See Also

Here's a list of references that might help explain some of the concepts I didn't delve into here:

Tags
Categories: Drupal News

Trellon.com: CRM Core Documentation is Live

Sun, 24/03/2013 - 3:12am

The documentation for CRM Core has been updated on Drupal.org. Now that the module has achieved a stable version, we have updated most of the information available about how to use it.

Go check it out.

read more

Categories: Drupal News