Drupal 7.x

Views integration with the relation module

Submitted by jesse on

​Introduction

Relations is an awesome new module for Drupal 7. It essentially allows you to link any entities together and which are themselves fieldable. I can think of limitless ways in which this can be super useful. However, the topic of this blog posting is not to heap praise on relations and explain in detail what they can be used for; I'll let you discover that yourselves. The intention is rather to give a practical example of how to create views of separate entity types tied together with relations. Something that I've had to play around with for hours to figure out. Perhaps this will save you some time.

Note: ​At the time of writing this the functionality I'm discussing only exists in the dev release of relation. Beta3 does contain this. If people from the future are reading this blog the functionality was commited Jan 21st by chx.

​An Example relation

Just read about this example on the d.o. issue queue where someone needed help with the views integration. So, lets say we create a relation that defines a relationship between a user and nodes called 'follow'. So that is to say a user can select particular nodes they deem interesting and choose to follow them.

Note: ​This could be accomplished other ways as well such as using the flags module, but we'll ignore that for now and consider that a relation can probably give us more functionality. 

We add a field to the 'follow' relation called 'category' to categorize the nodes which the user is following.

So now what we have is a directional relation user -> node ​with the single field 'category'.

The Definitive Guide to Drupal 7

Submitted by openconcept on

Definitive Guide to Drupal 7 BookOpenConcept has been donating books to the Ottawa Public Library for a couple years now, and so last fall I ordered a bunch of Drupal 7 books anticipating that we'd review them within our team & then order new ones to the library had a fresh copy. I ordered my copy of the Definitive Guide to Drupal 7 (DGD7) back in 2010 along with several others. Well, Drupal 7 took a while to get finalized and so many of the books which were started then didn't actually get finished until after Drupal core had been finalized in January.

It was just after Dries keynote at the Chicago DrupalCon that Benjamin Melançon approached me at the last moment to try to get an accessibility appendix added to the the book. With all of the accessibility enhancements that had gone into Drupal 7 & the emphasis that Dries gave it for the Drupal 8 process, it was clear that this needed to be covered in the book. It's been a long process working on Drupal core and I've had the pleasure to work with Bojhan Somers, Jacine Luisi, Károly Négyesi, Nathaniel Catchpole and Roy Scholten. I've met with other contributors at DrupalCons and DrupalCamps I have attended -- this is definitely a book which is very representative of this broad community. {C}

Drupal Accessibility as an Example

Submitted by mgifford on

Note: The video/audio of this presentation is now available thanks to Patricia Shaver from the University of Guelph.

My presentation at AccessConf - Your Help is Needed

I took a great opportunity to go to Guelph to both participate in and present to the 2011 Accessibility Conference. I was able to meet with a number of great accessibility professionals from Southern Ontario who were gathered for this event at the University of Guelph.  I missed the A11yCamp which Sean Yo organized and also to Derek Featherstone's HTML5/CSS3 training, but sent two of my team to it.

In thinking about what to present to this audience I had rethink a few things.  In presenting to Drupal audiences I had to go into depth about accessibility and work to educate the audience about the various ways that their sites are perceived & operated.  Many of the people in the audience had more experience in this area than I did so this wouldn't have been much of a benefit.  There were a surprising number of Drupal people in attendance as many universities in Ontario are now using it as their default CMS.  That being said, I didn't feel that there would be enough to justify a talk focusing on this one system.  

I decided to focus the presentation what can be learned from Drupal that can be applied to any system.  There are best practices in accessibility that have been defined in Drupal and that I do hope are adopted by other systems.  I figured it would be worth pulling out some of the highlights from Drupal 7's enhancements that I think still stand as best practices and that are generic enough that they could be emulated by others.  I wanted to use this session to talk about ways the ways that with greater collaboration we could take and improve these best practices for all systems.

I was hoping that the video would be available online right now, but for now I'll summarize my presentation notes & provide a link to the slides.

{C}

Gitting Earth Hour & Drupal

Submitted by mgifford on

We've used CVS, SVN over the years and are now using Git. If you've not a programmer you probably wouldn't be familiar with tools like Concurrent Versions System or Subversion which allow for precise sharing & collaboration between thousands of people but with over 150,000 lines of code in Drupal Core, you really need to have a way to manage these details to ensure that you've got the highest quality control possible.  Git is the latest in social coding and because if it's distributed framework it should allow many more people to evaluate, experiment & collaborate with the Drupal community.  

Git & Drupal

Knowing that Drupal was adopting Git, we made the move to adopt it, replacing many of our other repositories.  There is quite a learning curve to get it set up and integrated with our processes, but it's been very impressive thus far.  Our ability to quickly integrate around a standard tool set that allows us to both track & centralize changes for our projects is already beginning to pay off.  Configuration files, default error messages, custom modules, client themes, not to mention Drupal core and community contributed themes/modules.  

Say No to IE6 the Drupal Way

Submitted by mgifford on

There's just so much great stuff going on with modern browsers, mobile devices and HTML5, so how does the Drupal community our our best to help innovation by encouraging IE6 users to upgrade to a modern browsing experience.  Now Drupal 7 (core) is still will be providing support for IE6, but we really don't want to have to support it for Drupal 8 (which could well be released before IE6 is finally laid to rest by Microsoft).   I've written a short note that we're using for our visitors to give them the tools that they need to finally make the move.  However, I thought I should document a nice way to do this in Drupal 7.  Much of this will be the same for Drupal 6.

Now there are ways to do browser detection with jQuery or other tools, but for Drupal 7 the easiest way seems to be to add a conditional CSS file to the header through the template.php file. The conditional statements work fine for IE 6 & 7, so they do the trick nicely:

Launching Early with Drupal 7

Submitted by mgifford on

We've been very busy working on Drupal 7 enhancements for the last two years.  It's gotten really hectic around our office in the last few months so we're not able to devote the time we wanted to launch a flashy new design.  We've got a new design in the works to replace the one we set up back in early 2007 when Drupal 5 came out, but we've been prioritizing our efforts on getting to our clients sites rather than finishing up ours.  

Setting Up Drupal 7's Private File System

Submitted by mgifford on

I just updated the docs on drupal.org and discovered that D7 will take care of the permissions.

A screenshot of Drupal 7's file system config pageI was working on my first Drupal 5 to 7 migration earlier today and ran into an issue with the file system I hadn't needed to define previously. Drupal 7 has both a public and private file system path that you can define. This is great for security as you can easily divide what files you want available to the anonymous public and which they should be denied access. Drupal can be used to control delivery to users with appropriate permissions.

This is great, but there aren't enough active descriptions out there of how to do this yet. The DrupalHandbook of the Drupal 7 File System is pretty clear, "Files in the private directory are not accessible directly through the web server; when private files are listed, the links are Drupal path requests," is pretty clear, but doesn't provide a practical example.

I posed the question on Twitter, "if a Drupal 7's root is /home/drupal & the public files are in /home/drupal/sites/example.com/files where should the Private file system path be?" Following up by stating that from purely a backup perspective it would be nice if all client files were just in /home/drupal/sites/example.com/private and Apache is used to exclude access.

Accessibility Enhancements for Drupal 6 Themes - Admin Side

Submitted by mgifford on

The last in the series of Drupal 6 accessibility enhancements that we're publishing will focus on improving the admin side. There is a good guide to developing theme overrides on Drupal.org. This post provides examples of modified functions that are improvements over what is in Drupal 6, mind you there are several elements fixed in Drupal 7 which can't easily be back-ported.

Now the distinction of admin side vs user facing is a bit outdated in most modern CMS's. In most cases, the same HTML tools that are required to administer a site may also be used to make a nice interactive site. Usually it's a matter of making sure that any forms are presented in an accessible manner.

Accessibility Enhancements for Drupal 6 Themes - Public Pages

Submitted by mgifford on

Following my previous post with examples about using invisible elements, this post includes further examples of how to use the template.php file to overwrite Drupal 6's default functions for greater accessibility. More details on how to use these functions are available from Drupal's documentation.

With many sites, the only forms that they have available is the search function. This is a more accessible rewrite of template_preprocess_search_result()

 function EXAMPLE_preprocess_search_result(&$variables) { $result = $variables['result']; $variables['url'] = check_url($result['link']); $variables['title'] = check_plain($result['title']); $info = array(); if (!empty($result['date'])) { $info['date'] = format_date($result['date'], 'small'); } if (isset($result['extra']) && is_array($result['extra'])) { $info = array_merge($info, $result['extra']); } // Check for existence. User search does not include snippets. $variables['snippet'] = isset($result['snippet']) ? $result['snippet'] : ''; // Provide separated and grouped meta information.. $variables['info_split'] = $info; $variables['info'] = implode(' - ', $info); // Provide alternate search result template. $variables['template_files'][] = 'search-result-'. $variables['type']; }

Why Bother with Web Accessibility?

Submitted by mgifford on

I'm happy to announce that the video of my presentation is now online. Thanks DBNStudios for recording it. I'd also like to thank @cobalt123, @Chris Devers, @Let Ideas Compete, @OlsenWeb, @crizzirc, @mcbeth, @liber, @leshoward, @willem velthoven, @nickhall, @Stefan, @cobalt123, @Kalense Kid, @Kalense Kid, @PhillipC, @United Nations Photo, @ChrisGoldNY, @Norma Desmond, @Sara G..., @Dan Kunitz, @Gabor Hojtsy, @Christolakis, @Don Solo, @cobalt123, @Rene Ehrhardt, @patrick h. lauke, @m.gifford, @, @NJLA: New Jersey Library Association licensing their images under a creative commons license so that I could use them in this presentation. Sadly, I was not organized enough to have them incorporated in the video presentation unfortunately.

Photo from DrupalCon Montreal's Closing Plenary This weekend I presented a session at Drupal Camp Montreal 2010 on Drupal 7 & Accessibility. I always get nervous around presentations, but this is an important issue in which I have invested a lot of time & effort in the last two years. I've blogged about the HTML5 slide presentation, but it's also interesting.

I had a few goals in doing this presentation and I'm not sure how well I did in covering them. I certainly did raise the issue of Accessibility in the Drupal community. Many people were aware that there are some accessibility enhancements in D7, but there were a few who were not familiar with the W3C's Web Accessibility Initiative Web Content Accessibility Guidelines or the WCAG 2.0 P.O.U.R. objectives.

Guidelines like WCAG are an indispensable part of improving accessibility, but they aren't the only means tool at our disposal and shouldn't be used in isolation. They are guidelines which can be used in conjunction with user feedback & expert advice.

Pages

Subscribe to Drupal 7.x