Blog Archives

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

Recursively Finding and Operating on the Largest n Number of Files of a Particular Type

If you want to reverse-engineer this, you can work from left to right, adding one command at a time to see what each step does to the output.

This example just lists the files we found, which is pointless

Tagged with: ,
Posted in Development

Extracting Image “src” Attributes from an HTML String using PHP

Here are a few ways to build an array of image sources extracted from an HTML string. I’m sure there are other ways, but these seem to be reliable.

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

Auto-create URL Redirects in Feeds

I’m working on a website redesign. The original site used awful URL aliases where nearly everything got a URL like /content/title-of-page-would-end-up-looking-like-this. There are no “sections” to speak of in the URL structure, and there are several thousand nodes! I’m migrating most

Tagged with: , , ,
Posted in Development

Adding Metatag Keywords to Search API Index

For a great explanation of the implementation below, please visit http://enzolutions.com/articles/2015/06/02/how-to-add-customs-fields-to-solr-index-using-entity-api-amp-search-api/ The following demonstrates how to add metatag keywords (from the Metatag module) to your Search API fields list, so that you can index them and make them searchable.

Tagged with: , , , ,
Posted in Development