Blog Archives

Adding Entity Wrapper Class from Field Value using Display Suite

NOTICE: This works fine in Drupal 7. For Drupal 8 please see https://www.drupal.org/node/2863420 Sometimes as a developer you need to provide your Drupal authors with the ability to choose different variations of a particular content object. For example, imagine you have a Callout paragraph bundle

Tagged with: , , , ,
Posted in Tech Tips

Friendly URL for Views Contextual Filter on a Boolean Field

I have a story content type that has a corresponding Views listing page. The stories can be flagged as Featured through a checkbox/boolean field ( field_story_featured ). The stories also have a Story Type value ( field_story_type ). The views listing page needs to have the

Tagged with: , ,
Posted in Development

Quickly Implement a Block as a Paragraph in Drupal 7

Disclaimer: As with most tasks in Drupal, there are several ways to do this. My goal here was to see how quickly it could be done without writing code and without introducing unnecessary complexity. Goal — quickly implement a newsletter

Tagged with: , , , , ,
Posted in Development

Sort “Select an existing field” options in Drupal by Label instead of Type

Normally Drupal sorts the “Select an existing field” select list by the field types. Here’s an example of what this looks like: This looks good at first glance, but often it’s hard to quickly find the field you want to

Tagged with: , ,
Posted in Development

Bulk Add URL Redirects in Drupal 7

Here’s a quick example showing how to add URL redirects (for the redirect module) in bulk. Instead of a separate page for each list of “fellows”, we built a single view with exposed filters to choose a semester. The original

Tagged with: ,
Posted in Development

Adding a “Filter by year” Facet for a Date Field in Apachesolr for Drupal 7

A Drupal 7 site I’m working on makes use of the Apache Solr Search module and FacetAPI. Some of the content has a date field named field_s_date. I was tasked with providing a sidebar “Filter by year” facet block to filter

Tagged with: , , ,
Posted in Development

Rendering an Image in Apache SOLR Search results (Drupal 7)

Introduction There are a few ways to get extra information into the output of your Apache Solr Search results. The most efficient ways involve getting the information into the solr index and pulling it directly from the solr index. We

Tagged with: , ,
Posted in Development

New Drush Commands to Identify and Compress Large Images

https://github.com/agileadam/large-images-drush I released a simple drush command file that provides two drush commands: large-images-list will list the largest images (by file size) found in a directory (and its subdirectories by default) large-images-compress will compress (shrink file size of) images and

Tagged with: ,
Posted in Development

Importing Paragraph Content with Feeds in Drupal 7

As I write this, there isn’t an established way to import data into Paragraphs using Feeds. This solution only caters to my particular fields, but it should serve as an example of one way to import HTML content into a basic

Tagged with: , , ,
Posted in Development