Items tagged Drupal

The Picture module helps you to use Drupal's image creation capabilities to set up responsive images using the picture element. It's a backport of the Responsive Image module in Drupal 8 core.
As I start porting the modules I maintain to Drupal 8, I'm hitting a few places where things haven't been intuitive to me. I'll try to work on the drupal.org documentation when I get a chance, but in the meantime I figured it would be worth writing up a few notes. A common task is creating a link, and adding classes and other attributes to it. The Responsive Share Buttons is basically just a block of links to social networks, so this was a key building block.
From a front-end point of view, most of the noise being made about changes from Drupal 7 to 8 have been around Twig and the libraries API. From my (limited) experience with Drupal 8 so far, both of these seem to be very positive changes.
On the importance of systems-based thinking in design and development for large projects
When you're building a big site, it's important for deployment of changes to be repeatable and testable across environments. Features can be a bit of a pain, especially handling variables in strongarm, so until Drupal 8 configuration management solves everything, the more change you can put into install and update hooks the better.
Recently I was working on a site where the design for table rows called for the row to be highlighted on hover with a border. Seemed simple enough, but the first attempt didn't work: tr:hover { border: 1px solid #000; } The trouble with this is that it increases the height of the table. As always, someone else had already faced the same problem, so the answer was on StackOverflow.
Pretty much every Drupal site I build uses views to a large extent, and these days generally media is ever-present as well. A common use case is building an image gallery, and it makes sense to use the file entities directly, rather than creating nodes whose sole purpose is to hold the image. The trouble is, it isn't obvious immediately how to get images displaying when building a view of files.
When writing CSS for a Drupal 7 theme, it's easy to forget that core includes utility classes. Yes, there's a whole load of stuff that you might want to override, or get rid of altogether, and you might want to use a base theme, like Zen or Tao or Mothership, but it's worth remembering that there is some useful stuff in core.
In case you didn't already know, Drush is great. It can massively speed up the Drupal development process. Here are some of the commands I use again and again, so I've got them all in one place for reference. *Run an install hook manually drush ev "module_load_include('install', 'mymodule');mymodule_install();" Clear the CSS & JS aggregation cache drush cc css+js Clear all caches drush cc all
Something I've only just discovered the usefulness of is code templates in Netbeans. I always used to have autocomplete set up in Outlook for common phrases like "if you have any queries, please get in touch", and saved a lot of typing. Having found the NetBeans templates module for quickly creating common bits of Drupal code, I started digging around in the default NetBeans options, and found that there are all sorts of little timesavers. Here are a few good ones:

Pages