Planet Drupal

Subscribe to Planet Drupal feed - aggregated feeds in category Planet Drupal
Updated: 41 min 24 sec ago

Friendly Machine: How to Remove Core and Module CSS from a Drupal 7 Theme

Thu, 24/04/2014 - 23:49

In the post on base themes that I wrote earlier this week, I pointed out that core adds a lot of CSS to your site that you may not want. If you find yourself overriding this CSS in your themes, you definitely have some bloat that you could trim down. You also run into this issue quite a bit with contributed modules. Views, Flexslider and Superfish are modules that typically add a lot of CSS I don't want.

So how to get rid of this potentially unwanted code? Below I've included a function that you can drop in your template.php file. Of course you need to replace YOUR_THEME in the function name with the name of your theme.

function YOUR_THEME_css_alter(&$css) {
// Remove Drupal core css
$exclude = array(
'modules/aggregator/aggregator.css' => FALSE,
'modules/block/block.css' => FALSE,
'modules/book/book.css' => FALSE,
'modules/comment/comment.css' => FALSE,
'modules/dblog/dblog.css' => FALSE,
'modules/field/theme/field.css' => FALSE,
'modules/file/file.css' => FALSE,
'modules/filter/filter.css' => FALSE,
'modules/forum/forum.css' => FALSE,
'modules/help/help.css' => FALSE,
'modules/menu/menu.css' => FALSE,
'modules/node/node.css' => FALSE,
'modules/openid/openid.css' => FALSE,
'modules/poll/poll.css' => FALSE,
'modules/profile/profile.css' => FALSE,
'modules/search/search.css' => FALSE,
'modules/statistics/statistics.css' => FALSE,
'modules/syslog/syslog.css' => FALSE,
'modules/system/admin.css' => FALSE,
'modules/system/maintenance.css' => FALSE,
'modules/system/system.css' => FALSE,
'modules/system/system.admin.css' => FALSE,
'modules/system/system.base.css' => FALSE,
'modules/system/system.maintenance.css' => FALSE,
'modules/system/system.messages.css' => FALSE,
'modules/system/system.menus.css' => FALSE,
'modules/system/system.theme.css' => FALSE,
'modules/taxonomy/taxonomy.css' => FALSE,
'modules/tracker/tracker.css' => FALSE,
'modules/update/update.css' => FALSE,
'modules/user/user.css' => FALSE,
'misc/vertical-tabs.css' => FALSE,
// Remove contrib module CSS
drupal_get_path('module', 'views') . '/css/views.css' => FALSE, );
$css = array_diff_key($css, $exclude);

This bit of code is something that I sorted out from a couple of different places. The Tao base theme uses something similar and Mike Herchel showed off some of his resets in a recent presentation at Florida DrupalCamp where I picked up a few I had missed. 

Categories: Elsewhere

Drupal core announcements: Seeking input from contrib maintainers on extending Drupal 6 support past Drupal 8's release

Thu, 24/04/2014 - 23:34

Over in #2136029 : Decide if and how to extend D6 security support 12 months past an 8.0.0 release there's been a very lively discussion on how to deal with the situation of having ~200K active Drupal 6 sites with Drupal 8 on its way. We're trying to strike a balance between allowing site owners and module developers ample time to migrate away from Drupal 6, while at the same time not unreasonably burdening Drupal's contributor community.

The latest proposal there by Dries is to extend support for security fixes only for Drupal 6 until one year past Drupal 8's release (or 8.2.0 in the new world order), in order to allow time for a viable migration path from D6 => D8 to materialize. We're actively seeking input from contrib maintainers on this proposal.

Note: the discussion is long, but the issue summary is up to date, so hopefully allows you to save some time. :)

Categories: Elsewhere

Doug Vann: Blue Drop Awards & Why It Matters

Thu, 24/04/2014 - 21:06

Further below is a crosspost of a page from Blue Drop AwardsUsed with permission. Before you read the crosspost, I would like to share why I support and believe in the mission of the BDA [Blue Drop Awards].

This year I'm volunteering time and supporting the BDA financially for the 3rd year in a row.
But why?

  1. I believe, and testimonies and feedback confirm, that there is lasting value in an awards program that is completely operated within our very own Drupal Community.
  2. I believe that many Drupal shops and freelancers are creating quality sites, and that the news of these accomplishments is not easily spread.
  3. I believe that the Blue Drop Awards creates a needed buzz around the many amazing accomplishments of the Drupal Community.
  4. I believe that DrupalCon is THE PLACE to take time out to recognize these accomplishments AND drink free beer as we do!
  5. I believe that our collective goal of marketing Drupal is made easier when we can point to a homegrown system that brings more awareness of our communities accomplishments. 
  6. I believe if more people get behind the Blue Drop Awards, the value will increase, the momentum will pickup and the Drupal Community will be better served.


There's no lack of opportunities to serve the Drupal Community. Is it preposterous to think that serving with the Blue Drop Awards is as important as squashing a Drupal 8 bug? I submit to you that the hard working people in our hard working community deserve recognition and praise in a public forum. Hanging the shiny Blue Drop Award in the wall of your office is a side benefit of the Blue Drop Awards. Sharing your success with the Drupal Community at large is far more valuable. More than valuable, it is necessary. Our community is SO LARGE that is simply not an option to be aware of, much less appreciate, the volume if amazing accomplishments that are being undertaken in the name of Drupal.

The Blue Drop Awards attracts these good people to a single place where they can take their hard work and have it compete while acquiring the recognition it deserves. And that is why the Blue Drop Awards deserves the recognition that many of us give to it!

----- begin crosspost of ----


Submitted by Erik Wagner on Thu, 04/24/2014 - 16:41

Since the Blue Drop Awards started in 2012, we have seen continual growth in the amount of positive feedback and participation. This has encouraged us to continue this project in hopes that we can help improve the public's knowledge of Drupal and show off the best of what Drupal has to offer. 


There have been a few, very vocal opponents to some of the changes that we made to the 2014 Blue Drop Awards website. I wanted to address these changes and the reasoning behind them and announce a few changes of our own in response.

First, I want to remind everyone that the 2014 Blue Drop Awards is an ALL volunteer organization. We have very limited funds and unfortunately, this year, we only have six volunteers and two sponsors. We’re thin on bandwidth and money, thus I would ask if you wish that the Blue Drop Awards be handled differently If you have specific feedback, please feel free to reach out to me directly, I’m happy to answer any questions or concerns that you may have.

Second, I want you to keep in mind that we (the volunteers organizing Blue Drop Awards) have tried to make the Blue Drop Awards as inclusive an organization as possible; an organization that represents and exalts the best of Drupal.


Since day one we’ve realized that we would like to make the Blue Drop Awards as accessible to both the Drupal community and people outside of the immediate Drupal community. Meaning, we want both Drupal companies and their customers to be able to come to Blue Drop Awards and participate. We also have the problem of dealing with fraudulent votes. We don’t want voters to create dozens of fake accounts to vote up their favorite website.

The first year we addressed this problem by requiring accounts for every voter. The problem is, we had very few voters besides the developers themselves. These websites are generally created for companies who are not active in the community. We had to make it easier for people to create accounts and vote or else this project was doomed to fail. Fast forward to this year-- we decided to limit the solution to Facebook, the most widely used social media network in the world. It also is more difficult to defraud than many of our other alternatives.


While we are an all-volunteer organization, there are still expenses that must be covered. Which is why we came up with the $10-$25 nomination fee. Below is a list of items that must either be paid for or donated:

  • Awards: We have 22 categories at the Blue Drop Awards (including site of the year). Each category receives an award. Each award costs roughly $50 to design and print for a total of $1,100.
  • Hosting: One founder has been kind enough to let us use theirs this year, but this is an expense we cannot guarantee will be covered next year.
  • Development: This year we have not had any volunteers to help with the development of the site. I’m not even sure how much we invested in this, but my guess is somewhere in the range of $5,000-$7,000.
  • Party: Last year’s party at Drupalcon Portland was not a cheap endeavor and this year we were hoping on hosting another party at a bar on Sixth Street during Drupalcon Austin. $7,000.

While not a complete list, these expenses alone can reach nearly $15,000 a year. To cover this amount, we would need to get 1500 nominations at the $10 fee or 600 nominations at the $25 fee. We have never had that many nominations and realistically, we do not expect to reach that number this year.

So, how do we cover the rest of our expenses? Perhaps we do not have a party? Perhaps no physical awards?

Blue Drop Awards Changes:

To continue with the Blue Drop Awards, we have made the following changes.

  1. Add Twitter login functionality. We do so at the possible cost of having a less accurate vote count.
  2. Reduce the nomination fee to $10. We do this at the potential cost of not having a party or physical awards for the winners.
  3. Extend the nomination period. Lastly, we have decided to extend the deadline for the nominating period to 5/5/14, giving everyone a full extra week.

We would really like the BDA to be what it was always intended to be: an award system that showcases the best of Drupal. But do that, we need everyone in the community to help. If we get enough donations, volunteers and sponsors, we could do away with the nomination fees altogether.


Drupal Planet

View the discussion thread.

Categories: Elsewhere

Cocomore: Drupalcamp Spain is approaching...

Thu, 24/04/2014 - 13:00

Drupalcamp Spain 2014 will be at Valencia on May 16-18th, and we will be there.

If you are attending, you will probably know that there will be sprints during all the camp, and you may want to sign up to the Valencia sprints. We will have tasks for everybody, no matter if you never contributed before or if you are not even a developer, so don't be shy and join us.

read more

Categories: Elsewhere

Chris Hall on Drupal 8: Drupalcon Amsterdam sprints do not require a ticket

Thu, 24/04/2014 - 10:07

Short and sweet, I am planning more activity for post Beta launch, but "Good news everybody".

After a bit a of activity on Twitter it was made apparent that a ticket is not required to attend Drupalcon Amsterdam sprints (presumably other Drupalcons as well). This is probably not news to some people but it appears many are not aware of this, or like me have not really thought about it. 

For those coming to #DrupalCon Amsterdam, solely to attend code sprints: you don't need a ticket for that. Feel free to come without!

— DrupalCon Amsterdam (@DrupalConEur) April 24, 2014

As a freelancer I was sadly coming to the conclusion that Drupalcon Amsterdam was out of reach, after ticket price, accommodation travel, loss of earnings etc. the expense is rather large especially when you have a family to consider (I find it hard to justify why I should spend so much on a holiday just for me). 

Now however I have the option to take a shorter hop and still get to meet some interesting people, perhaps even combine with another day or so in Amsterdam with my partner. 

This really extends the options for those of us not too far away from Amsterdam and thanks for the clarification.


Categories: Elsewhere

Jeremy Epstein: Sharing templates between multiple Drupal views

Thu, 24/04/2014 - 08:13

Do you have multiple views on your Drupal site, where the content listing is themed to look exactly the same? For example, say you have a custom "search this site" view, a "featured articles" view, and an "articles archive" view. They all show the same fields — for example, "title", "image", and "summary". They all show the same content types – except that the first one shows "news" or "page" content, whereas the others only show "news".

If your design is sufficiently custom that you're writing theme-level Views template files, then chances are that you'll be in danger of creating duplicate templates. I've committed this sin on numerous sites over the past few years. On many occasions, my Views templates were 100% identical, and after making a change in one template, I literally copy-pasted and renamed the file, to update the other templates.

Until, finally, I decided that enough is enough – time to get DRY!

Being less repetitive with your Views templates is actually dead simple. Let's say you have three identical files – views-view-fields--search_this_site.tpl.php, views-view-fields--featured_articles.tpl.php, and views-view-fields--articles_archive.tpl.php. Here's how you clean up your act:

  1. Delete the latter two files.
  2. Add this to your theme's template.php file:
    <?php function mytheme_preprocess_views_view_fields(&$vars) { if (in_array( $vars['view']->name, array( 'search_this_site', 'featured_articles', 'articles_archive'))) { $vars['theme_hook_suggestions'][] = 'views_view_fields__search_this_site'; } }
  3. Clear your cache (that being the customary final step when doing anything in Drupal, of course).
Categories: Elsewhere

Drupal Commerce: Improving the Experience of Commerce Bundles

Thu, 24/04/2014 - 07:28

Commerce Bundles, while very powerful, isn’t exactly the most user-friendly from a UI standpoint. However, it is very customizable and there are a few things we can do really easily to improve the overall experience:

Using a View for the Bundle Item Autocomplete

Out of the box, Commerce Bundle’s Bundle Item Autocomplete looks solely at the title. This doesn’t scale really well if you give all of your products in a set (e.g. S-XXL shirts) the same name, which is pretty common. So instead, we can modify the widget to use a custom view to load and search for autocomplete suggestions. To enable:

Categories: Elsewhere

AGLOBALWAY: Top 5 Reasons to Choose Drupal

Wed, 23/04/2014 - 19:26
Drupal is an open source content management platform for developing powerful, flexible and robust websites, social media networks and applications, that leads the market.   But why Drupal? What are the key points of this open source?     Flexibility   Drupal was created with the idea of ​​being flexible.Usually when someone looks for a feature or specific functionality, most of the time it has already been set or can be easily created. As a powerful open-source content management framework  used by a wide variety of small and large businesses, Drupal gives a handless countless content types, that includes text, blog, videos, podcasts, menu handling and optional revision control.      Highly Customizable   Drupal is designed with a highly customizable features, functionalities and layout that incentive the consumers to interact, share, and create their content.  Unlike other CMS products, Drupal don’t force you to work within a rigid paradigm that makes you build a website base the original developers thoughts. Most of the time a Drupal website can be structured in almost any imaginable way, but if the Drupal core or a contributed mode don’t do what you need, you always can go into the source code and develop your own customized functionality.      Rapid Development   Drupal gives you the opportunity to build internal or external-facing websites in matter of hours. With a single download, you can utilize a multi-site configuration or use a Drupal Distributor that provides you the essential features and functions to build a site.      Scalability   Drupal provides you a high scalable solutions that support enterprise level corporate websites and applications very easily. To be aware of the grandeur of the community that is using Drupal, these are some examples of websites with high traffic worldwide that are using Drupal: White House, CNN, Sony Music, Grammy’s, The Economist, Tesla Motors, UK government, and much more.     Security      Among with all the CMS’s of the world, Drupal is known as one of the most secure platforms available. Thanks to a constant review and excellent knowledge of handle security issues among thousand of developers, Drupal core is kept secure.    Tags: drupal planet
Categories: Elsewhere

Wunderkraut blog: Just get the files you need when you develop

Wed, 23/04/2014 - 15:34

When you work locally on development or test on stage/dev whatever you sometimes needs the files from production. Our old way in solving that is downloading the whole file catalogue and have it local. Sometimes the file catalogues where several gigabytes large so that is not a good workflow at all.

To solve that problem we are now using Stage file proxy. We have been using it for some time now to get files to stage or locally, and it works really well (we have some issues on D6-sites, but works almost flawless on D7-sites). Stage file proxy downloads the files that are requested from production (or whatever) site running environment.

So you just get the files you need, and you could easily delete the files locally and get them back when called for. Time and space saver.

A nice patch to the module is getting an admin-interface - so that you don’t need to add settings to settings.php or creating variables. EDIT: Greggles just committed that patch to dev :-)

Photo by James Butler

Categories: Elsewhere

Frederick Giasson: Exporting Entities using OSF for Drupal (Screencast)

Wed, 23/04/2014 - 14:41

This screencast will introduce you to the OSF for Drupal features that let you export Drupal Entities in one of the following supported serializations:

  • RDF+XML (RDF in XML)
  • RDF+N3 (RDF in N3)
  • structJSON (Internal OSF RDF serialization in JSON)
  • structXML (Internal OSF RDF serialization in XML)
  • ironJSON (irON serialization in JSON)
  • commON (CSV serialization to be used in spreadsheet applications)

I will show you how you can use OSF for Drupal to export entire datasets of Entities, or how to export Entities individually. You will see how you can configure Drupal such that different users roles get access to these functionalities.

I will also briefly discuss how you can create new converters to support more data formats.

Finally, I will show you how Drupal can be used as a linked data platform with a feature that makes every Drupal Entities dereferencable on the Web1. You will see how you can use cURL to export the Entities‘ descriptions using their URI in one of the 6 supported serialization formats.


  1. OSF for Drupal follows the Cool URIs for the Semantic Web W3C’s interest group notes
Categories: Elsewhere

Drupal Commerce: Commerce Module Tuesday: Commerce Add to Cart Extras

Wed, 23/04/2014 - 14:35

Commerce Add to Cart Extras is a great little module that provides the ability to turn a product listing view into an add to cart form. It does this by providing a new field that you add to a view which provides a quantity text box and makes the entire view an add to cart form. This differs from the existing “Add to Cart” field provided by commerce, which allows you to add a single item to the cart from a list.

This allows you to do some useful things such as creating a bulk order form which lists some or all of the products on your site, allowing customers to enter a quantity directly for the products they want. Or, you can utilize standard Views functionality to create another add to cart form for wholesalers on products with several attributes allowing them to add quantities of each individual product quickly and easily. Let’s take a brief look at how we can do this.  Just download and enable the module, and you’re ready to get started.

Video and run-down after the break.

Categories: Elsewhere

Károly Négyesi: How to crash your site

Wed, 23/04/2014 - 08:14

I got a desperate call about a site being down, this is ordinary for me (advertisment: you can contact me if it happens to you). But the error I saw was new to me. This is surprising -- I have thought I have seen it all and then some. The modules/views/includes/ was fataling about the function views_include not existing. At first I thought opcache went south cos how on earth could an include be loaded when the module isn't?? But it wasn't opcache. Next step was adding a debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) before the offending views_include call and behold... what?? variable_initialize?? o_O OH! Obviously the poor thing is trying to unserialize a views object but it's superb early in the bootstrap and so modules aren't loaded. So while unserializing the classloader loads which leads to this fatal. Neat. Moral of the story: don't ever try to store a views object in variables. Or an array containing a views object.

Categories: Elsewhere

Modules Unraveled: 105 Using Membership Entity to Set Up a Drupal Based Membership Site with Caleb Thorne, Bryan Jones and David Csonka - Modules Unraveled Podcast

Wed, 23/04/2014 - 07:00
Published: Wed, 04/23/14Download this episodeProject
  • What is the Membership Entity module?
    Project background
    First membership site developed was Mercedes-Benz Club of America (
    Involved a bunch of custom code.
    Entity API
    Key features
    Multiple users per membership (primary and secondary)
    Join/Renew online
    Role management
    Membership terms and modifiers
    E-Commerce solutions (coming soon)
    Commerce integration (Caleb)
    Ubercart integration (Bryan)
    product class
    Using product attributes to store membership data.
    Investigating better ways to store data before official release.

  • Do you handle pro-rated renewals?

  • Trials?
  • How are you guys dealing with role based permissions, and time limited access?
  • Are there different levels of membership?
  • Do you deal with CC details?
  • What other solutions did you guys look at before creating this one?
    • Why not just use profile2/rules/civiCRM or other existing modules?

The big problem with Profile2 is that it only allows one user per profile. Some fields should be shared for all users that belong to a single membership.
Membership Entity includes rules integration.
Membership Entity is 100% Drupal. No third party integration required.

Use Cases
  • Do you guys have any sites currently running the Membership Entity module?
    (David) - Joined the team after much of the development of the module was already done, so had the perspective of a developer on the outside, learning what the module provides and how to extend it. Being built around the Entity API made creating Views-based reports very simple, as most of the membership data that I needed to display was already exposed. For any that wasn’t, the extensible nature of the module (via things like all of the provided custom hooks) made the process of developing additional custom entities derived from membership meta-data rather straightforward.
    (Bryan) - Drop in solution for simple membership sites (CEMA).
    No custom code required.
    Membership process working in less than an hour.
    Integrated with Ubercart (Module coming soon).
Episode Links: draenen (Caleb Thorne)BryanDavid CsonkaMonarch DigitalMembership EntityCommerce integration (sandbox)Ubercart integration (sandbox)Module release blog postWe will be having a BoF at DrupalCon Austin. Watch for it atTags: 
Categories: Elsewhere

Darren Mothersele: Drupal Site Builder Patterns - The State Machine

Wed, 23/04/2014 - 01:00

In this new series for my blog, I'll be documenting some common design patterns for Drupal site builds. This first post is about the State Machine pattern, which is something I've used on several sites recently.

First, let me explain what I mean by "pattern". If you are already familiar with design patterns in Object-oriented software then you can probably skip this bit, but I think it's useful for context.

Design patterns?

Here's a quote from the original Gang of Four book on design patterns. That book is about design of object-oriented software, but I think it applies to Drupal development too. The quote is from p.1 of the book, apologies if I offend anyone by bastardising it. I've taken the liberty of substituting the words "Designing object-oriented software" with "building Drupal sites", and a few other substitutions to make my point...

[Building large maintainable Drupal sites] is hard... Your design should be specific to the problem at hand but also general enough to address future problems and requirements [and be maintainable]... Experienced [Drupal site builders] will tell you that a reusable and flexible design is difficult if not impossible to get "right" the first time.

Yet experienced [Drupal site builders] do make good designs. Meanwhile new [site builders] are overwhelmed by the options available and tend to fall back on non-[Drupal] techniques they've used before. It takes a long time for novices to learn what good [Drupal site building] is all about. Experienced [site builders] evidently know something inexperienced ones don't. What is it?

One thing expert [site builders] know NOT to do is solve every problem from first principles. Rather, they reuse solutions that have worked for them in the past. When they find a good solution, they use it again and again. Such experience is part of what makes them experts.

So I've been looking at what these "good solutions" are that I might have been using, and as I identify them I've been documenting them along the same lines of the original design patterns from the Gang of Four book:

  • Pattern name - the handle we use to describe the problem
  • Problem - explain the problem and its context, and when you might want to use this pattern
  • Solution - describe the elements that make up the solution, in my case how the pattern can be best implemented in Drupal
  • Consequences - results and trade-offs of using the pattern, in this case I also consider further issues that many need to be considered as a result of using the pattern.

So, first let's look at what a state machine is, and what problems it solves, before going on to look at how to configure it in Drupal.

State Machine

A state machine is a theoretical computer science concept that provides a mathematical basis for modelling computation. But don't worry, the kind of state machines we'll be using don't require a degree in computer science to understand.

All you really need to know is that the state machine (or more correctly a Finite State Machine) has a finite number of "states" it can be in and the machine is only ever in one of these states at a time, it's current state. The state machine can change from one state to another triggered by an event or condition. This change of state is called a transition. A state machine is typically visualised using a state machine diagram, for example:

As you can see the states are represented by an ellipse with the name of the state inside, the arrows denote the possible transitions. You can also see how the entry point and exit point would be notated.

Here's a (very simplified) example of a ticket in an agile issue queue. In reality this would probably have several other states but for the sake of this example, here's a simple state machine for the ticket:

A state machine is defined by the list of possible states and the event/condition that triggers each transition.

If you're reading this and thinking "Events", "Conditions", sounds a bit like Drupal Rules, then you've already worked out how we're going to implement this in Drupal!

In this simple ticket example the states are "In progress", "Approval", and "Finished". The transitions are "Completed", "Rejected", "Accepted".

When to use it?

It might be useful to think that in business speak, when they say "business processes" they are actually talking about state machines. Here are some cases when you might want to think about state machines:

  • If you've ever had to model a "state" or "status" field, then you've got a good candidate for a state machine.
  • If you've ever wanted to anything more complex than just published and unpublished nodes then you have a good candidate for using a state machine.
  • If you have boolean fields in your content model called things like "paid/unpaid".
  • If you have records that need to expire after a specific period of time

Drawing out a state machine diagram to model this kinds of problems can be really useful to help identify any "edge-case" scenarios you may not have thought of, and capture them early in the design process. It also shows you exactly what you need to test further along in the site build.

Let's build it

As with anything in Drupal there are several ways to achieve this functionality, in fact there's even a State Machine module, but that relies on creating custom plugins. If you're a developer you might want to take a look at this module.

Workbench Moderation and various other workflow modules include a state machine implementation for a specific purpose.

The approach documented here is suitable for site builders, is flexible, and provides a neat solution that can be configured using the following contributed modules:

I said before that the state machine is defined by it's set of possible states and set of transitions. In Drupal we'll be using a simple list field to store the list of possible states for the node.

In a recent post on they mention the addition of the ability to hide form fields in Drupal 8 core. In Drupal 7 we need a module to help us do this. In this case we are adding a field that will never be directly edited by the user so we just deny access to edit that field using the Field Permissions module.

For the simple ticket example, we have 3 states. So use an integer list field with the following allowed values:

  • 0|In progress
  • 1|Awaiting approval
  • 2|Finished

I said that the state machine was defined by the set of possible states (implemented by our list field), and a set of transitions. These transitions can be implemented using the Rules Link module.

Using the Rules Link module you can add a button to the ticket node which manipulates the "state" value preventing the user from actually editing the value in the state field directly, and thus enforcing the workflow defined in our state machine.

Each "Rules link" is configured in two parts. First you define the conditions for when the link should be visible using standard Rules conditions. Secondly, you use the rules reaction to set the value of the state field to the new value (and perform any other actions that you want as a side effect of the transition).


It's good to follow a principle of audit-ability, so you probably need to keep the transition history. A simple solution might be to add a timestamp field such as "confirmed at" to mark when it went to confirmed state. If using node, you could log revisions to track state changes in the revision log for the node. Or you could look at Messages module to log messages when state changes happen.

More patterns

If you're interested in learning more from my 7 years of Drupal experience (and if you're based in London) why not join me for Everything I Know About Drupal an intensive 2-day Drupal training I've been working on. It's taken a lot of preparation, and there's still a small number of tickets available. You can find more information on my blog post about it or grab a ticket on the Eventbrite page.

Categories: Elsewhere

Evolving Web: DrupalCamp NYC at the United Nations - Recap and Photos

Tue, 22/04/2014 - 23:52

This year's DrupalCamp NYC was held at the United Nations. The camp was crammed with summits and useful sessions and included a lot of content about Drupal 8.

read more
Categories: Elsewhere

Drupalize.Me: Webinar: Easily Create Maps with Leaflet

Tue, 22/04/2014 - 21:50

Curious about Leaflet? Join Drupalize.Me Trainer Amber Matz for a live tutorial on how to add Leaflet maps to your Drupal site during this Acquia hosted webinar on May 1, 2014 at 1:00 PM EDT.

Categories: Elsewhere

Dcycle: Simpletest Turbo: how I almost quadrupled the speed of my tests

Tue, 22/04/2014 - 21:15

My development team is using a site deployment module which, when enabled, deploys our entire website (with translations, views, content types, the default theme, etc.).

We defined about 30 tests (and counting) which are linked to Agile user stories and confirm that the site is doing what it's supposed to do. These tests are defined in Drupal's own Simpletest framework, and works as follows: for every test, our site deployment module is enabled on a new database (the database is never cloned), which can take about two minutes; the test is run, and then the temporary database is destroyed.

This created the following problem: because we were deploying our site 30 times during our test run, a single test run was taking over 90 minutes. Furthermore, we are halfway into the project, and we anticipate doubling, perhaps tripling our test coverage, which would mean our tests would take over four hours to run.

Now, we have a Jenkins server which performs all the tests every time a change is detected in Git, but even so, when several people are pushing to the git repo, test results which are 90 minutes old tend to be harder to debug, and developers tend to ignore, subvert and resent the whole testing process.

We could combine tests so the site would be deployed less often during the testing process, but this causes another problem: tests which are hundreds of lines long, and which validate unrelated functionality, are harder to debug than short tests, so it is not a satisfactory solution.

When we look at what is taking so long, we notice that a majority of the processing power goes to install (deploy) our testing environment for each test, which is then destroyed after a very short test.

Enter Simpletest Turbo, which provides very simple code to cache your database once the setUp() function is run, so the next test can simply reuse the same database starting point rather than recreate everything from scratch.

Although Simpletest Turbo is in early stages of development, I have used it to almost quadruple the speed of my tests, as you can see from this Jenkins trend chart:

I know: my tests are failing more than I would like them to, but now I'm getting feedback every 25 minutes instead of every 95 minutes, so failures are easier to pinpoint and fix.

Furthermore, fairly little time is spent deploying the site: this is done once, and the following tests use a cached deployment, so we are not merely speeding up our tests (as we would if we were adding hardware): we are streamlining duplicate effort. It thus becomes relatively cheap to add new independent tests, because they are using a cached site setup.

Tags: planetblog
Categories: Elsewhere

AGLOBALWAY: Drupal & Bootstrap

Tue, 22/04/2014 - 19:34
Here at AGLOBALWAY, we are constantly learning to take advantage of the myriad of tools available to us whether for communication, productivity, or development. As a company dedicated to all things open source, one of the tools we employ is Twitter’s Bootstrap framework. Thanks to the industriousness and generosity of companies like Twitter, (or Zurb for its own Foundation framework, among others), the web community has a tremendous amount of resources from which to draw upon.   Drupal has been a key content management framework for us ever since the inception of our company for its flexibility, power, and configurability. Bootstrap has made an excellent companion for Drupal in several of our projects so far, so I will highlight just a few of the many ways that a Bootstrap-based theme can compliment your Drupal website.   Bootstrapped Style   While some decry the design style and “look” that is quintessentially Bootstrap, there really is no need to. Yes, it has been a major influence on modern web design trends. Bootstrap has prepackaged layouts and default styles for nearly all UI elements, taking away the need to create styles for everything. But, building a unique site that doesn’t follow that typical Bootstrap style own doesn’t have to be difficult. The real undertaking is in learning the ins and outs of the preprocessor system employed by Bootstrap (Less, in this case), and how they have laid everything out.   Once familiar with the system, one will quickly realize that it’s relatively straightforward to take advantage of all of the mixins and variables already given in order to generate the styles you have designed. In one .less file, we can quickly define colours, sizes, and other default settings that will appear throughout your site. Again, like the JavaScript libraries above, this is not unique to Drupal. However, being able to take advantage of these tools helps immensely to speed up the development cycle of building Drupal sites.   JavaScript Libraries   Having access to a number of common functions used throughout the web is a huge time saver. Already bundled with jQuery, a Drupal Bootstrap-based theme allows for easy integration of accordions, image carousels and more, without having to write your own JavaScript. While these libraries are certainly not exclusive to Drupal, there can be unique ways of making use of them with Drupal. For example, rendering a block inside of a modal for a login form is a snap, and css is all you really need to customize it once you initialize it with the proper JavaScript.   Another example would be to pair Bootstrap with the popular CKEditor module to generate templates, using Bootstrap’s markup. Users may want to place an accordion inside their own managed content, so we can create a template with CKEditor’s default.js file (even better, create a separate file and use that one instead), following the pattern of the templates already given. Add the Bootstrap markup with the appropriate classes, and voila! Your users now have an accordion they can insert using only the WYSIWYG editor.   Bootstrap Views   This is a Drupal module I have yet to really play around with personally, but a cursory look tells me just how easy it can be to display content using Bootstrap elements without even getting into template files or writing code. While I generally prefer to separate markup from data output, I can see the potential here for a lot of time saving, while avoiding some head-scratching at the same time. This is the whole point of views in the first place - making it easy to display the content you want without having to dive too deep.   As we can see, integrating Drupal with Twitter Bootstrap has considerable advantages. While its heaviness is a fair criticism, I believe those advantages justify the use of Bootstrap, particularly in an Agile development environment. Besides, we can always eliminate the JavaScript or CSS we don’t use once we’re done developing our site. Whether it’s Bootstrap, Foundation, or your framework of choice, having such front-end tools to integrate with Drupal can only be a good thing. Many thanks to all who are dedicated to creating and maintaining these resources for the benefit of us all. Tags: drupal planetBootstrap
Categories: Elsewhere

Propeople Blog: Propeople at Stanford Drupal Camp 2014

Tue, 22/04/2014 - 19:26

This past weekend, some of our team had the pleasure of attending Stanford Drupal Camp, which Propeople supported as a Gold Sponsor. Stanford University is one of the biggest advocates of Drupal in higher-education, and is home to an active and passionate Drupal community. Hosted on the world famous (and too-gorgeous-to-put-into-words) Stanford campus, the Stanford Drupal Camp is an annual event focused on Drupal and the state of Drupal at the university (where thousands of websites are powered by the CMS). Propeople has participated in the event the past few years, and we've had the pleasure to work on a wide variety of Stanford projects in the same amount of time. These include the Stanford Graduate School of Business, SLAC National Accelerator Laboratory, Stanford Student Affairs, Riverwalk Jazz, and many others. 

Stanford Drupal Camp featured a great line-up of sessions and talks all day Friday and Saturday, ranging from the simple to the complex. The talks focused on a variety of topics, from site building to Agile and Scrum methodology to specific Drupal use cases in higher education. As you can expect at any Drupal camp, more casual BoFs and lightning talks were interspersed throughout the conference.

We were happy to have the packed schedule include two sessions presented by one of Propeople’s own Drupal experts, Yuriy Gerasimov, on Saturday. Yuriy’s first session was titled “CI and Other Tools for Feature Branch Development”, aimed at helping developers and organizations implement feature-branch workflow. The second was “Local Development with Vagrant”, which, as you might have guessed from the title, was all about the benefits of using Vagrant to spin up local virtual machines with the same settings on different platforms.



Overall, the many sessions, BoFs, and lightning talks provided Stanford staff, faculty, students, and developers (from the university and beyond) with plenty of great information.

In addition to the full session schedule, Stanford Drupal Camp featured plenty of opportunities for those at the event to enjoy each other’s company, catch up, and engage in some great conversation about every attendee’s favorite topic...Drupal! As a technology partner to more than a dozen Stanford departments and institutions, Propeople has learned first hand how great the Stanford community is, and it was a treat to have some of our team on campus to join in on the fun at Stanford Drupal Camp. We’ll be looking forward to next year!

Tags: DrupalDrupal campStanfordCheck this option to include this post in Planet Drupal aggregator: planetTopics: Community & Events
Categories: Elsewhere

Phase2: Exploring Maps In Sass 3.3(Part 3): Calling Variables with Variables

Tue, 22/04/2014 - 19:25

For this blog entry, the third in a series about Sass Maps, I am going to move away from niche application, and introduce some more practical uses of maps.

Living Style Guides

In my current project, a large Drupal media site,  I wanted to have a style guide, a single static page where we could see all of the site colors, along with the variable name. I collected all of my color variables, and created some static markup with empty divs. Below is the loop I started to write.

<!-- The HTML for our Style Guide --> <div class="styleguide"> <div class="primary-color"></div> <div class="secondary-color"></div> <div class="tertiary-color"></div> </div>

// Our site color variables $primary-color: #111111; $secondary-color: #222222; $tertiary-color: #333333; // Make a list of the colors to display $styleguide-colors: primary-color, secondary-color, tertiary-color; // Loop through each color name, create class name and styles @each $color in $styleguide-colors { .styleguide .#{$color} { background-color: $#{$color}; // Spoiler Alert: Does not work!! &:after { content: “variable name is #{$color}” } } }

This loop goes through each color in my $styleguide-colors list and creates a class name based on the color name. It then attempts to set the background-color by calling a variable that matches the name from the list. We also set the content of a pseudo element to the variable name, so that our styleguide automatically prints out the name of the color.

This is what we want the first loop to return:

.styleguide .primary-color {  background-color: $primary-color; // Nope, we won’t get this variable  &:after {      content: “variable name is primary-color”    } }

The problem is that we can’t interpolate one variable to call another variable! $#{$color}  doesn’t actually work in Sass. It won’t interpolate into $ + primary-color , and then yield #111111  in the final CSS. This 3 year old github issue points out this exact issue, and hints at how maps is going to be introduced in Sass 3.3 to solve this problem.

Make it better with maps

So now that we have maps, how can we create this color styleguide? Lets take this a step at a time.

First we need to wrap all of our colors in a map. Remember, any of these colors can be accessed like this: map-get($site-colors, primary-color)

$site-colors: (  primary-color: #111111,  secondary-color: #222222,  tertiary-color: #333333, );

Now we can create a list of the colors we want to iterate through and loop through them just like we did before.

$styleguide-colors: primary-color, secondary-color, tertiary-color; @each $color in $styleguide-colors {  .styleguide .#{$color} {    background-color: map-get($site-colors, $color); // This DOES work!    &:after {      content: “variable name is #{$color}”    }  } }

This time when we loop through our colors we get the same class name and pseudo element content, but lets look at what happens with the background color. Here is the first pass through the loop, using primary-color as $color :

.styleguide .primary-color {   background-color: map-get($site-colors, primary-color);   &:after {      content: “variable name is primary-color”    } }

As you can see in this intermediate step, we are able to use map-get($site-colors, primary-color)  to programmatically pass our color name into a function, and get a returned value. Without maps we’d be stuck waiting for $#{$color} to be supported (which will probably never happen). Or in the case of my project, write all 20 site color classes out by hand!

Make it awesomer with maps

Astute readers might realize that I am still doing things the hard way. I created a map of colors, and then duplicated their names in a list called $styleguide-colors . We can skip that middle step and greatly simplify our code, if we are wanting to print out every single value in the map.

$site-colors: ( primary-color: #111111, secondary-color: #222222, tertiary-color: #333333, ); @each $color, $value in $site-colors { .styleguide .#{$color} { background-color: $value; &:after { content: “variable name is #{$color}” } } }

Now, instead of passing a list into the @each loop, we pass the entire map. We can do this with the following pattern: @each $key, $value in $map . Each iteration of the loop has access to both the key primary-color  AND the value #111111 , so we don’t even need the map-get function.

The ability to ‘call variables with variables’ is incredibly useful for creating these programmatic classes, and is a foundational process upon which we start to build more complex systems. Be sure to check out part 1 and 2 of my Sass Maps blog series!

Categories: Elsewhere