Drupal Planet

Custom Video Export/Import Process With Views and Feeds

Creatng a custom video node export/import process using custom forms, RSS feeds with Views, and a custom Feeds importer using the SimplePie parser.

continue reading >>

May 2

Getting URL Alias For Referenced Entity With RESTful API in Drupal

As documented in a previous post, with RESTful, you can create a separate API endpoint to look up the base node ID from a URL alias for a specific entity. However, there are also URL aliases for other entities that are referenced from within your base entity, such as users and taxonomy terms. We don't want to have to do a separate lookup for each of these entities outside of our base entity, so the ideal situation would be to just have a field returned within our base entity lookup that contains these URL aliases.

continue reading >>

Dec 26

Creating a RESTful API URL Alias Lookup in Drupal

Over the past few months (since Drupalcon LA), I have been actively diving in to the world of decoupled Drupal, in particular using AngularJS as a front end. After going through many tutorials and looking at the multiple options for providing an API from Drupal to be consumed by Angular, I settled on using the RESTful module. One thing I like in particular about it is that you have to explicitly define what you want available in your API, as compared to everything being automatically being made available when the module is enabled. Another great feature I discovered is that you can also easily create custom endpoints that expose data from custom database queries. A perfect example of this is looking up an entity id from a URL alias.

continue reading >>

Dec 5

Custom Image Search with Solr, Filefield Sources, and Ctools - Part 3

In our quest to build a custom image search functionality, we are at the last two steps. We have the ability to display a modal window, search for images, and page through the results; now we just need to be able to write the file name and file id back to the source text field so it can be added to the node. Also, in the last post, we just glossed over the code that actually gathers the search parameters and searches Solr, so we will cover that code in detail here.

continue reading >>

Sep 21

Custom Image Search with Solr, Filefield Sources, and Ctools - Part 2

Continuing on from my previous post, we are working on building a custom image search in Drupal using Apache Solr, Filefield Sources, and Ctools. So far, we have created our custom FileField Source element that will allow us to search. Now we get to the actual searching functionality. The first thing we need is a modal window that will display our search form and the search results. As mentioned in the first post, our source link has the ctools-use-modal class, which will cause the link to open our page callback in a modal window. 

continue reading >>

Sep 21

Custom Image Search with Solr, Filefield Sources, and Ctools - Part 1

Over the years I have been a big fan and user of Apache Solr for search on Drupal sites, in particular using the Apache Solr Search set of modules, mostly because of it's speed and ability to create facets for drilling down into search results, along with the flexibilty provided by the module API to customize the functionality as needed. While re-building the NewsBusters site from scratch in D7 last year, one of the issues that the users wanted to address was finding existing images to re-use in blog posts. The existing functionality used a file browsing functionality in the WYSIWYG, and as the number of images added to the site grew, just loading the browser to search for an image could take a few minutes. Another change we were making in the D7 version was storing all of our images on Amazon S3 (using the S3FS module), so I figured that I would take this chance to create a custom image search that used Solr. This would address speed issues, and would also allow the users to index metadata about images that could be used later to search for images.

continue reading >>

Sep 19

Connecting to a remote MS SQL Server database from Mac OS X

As part of an e-commerce site I'm working on, I had a need to update my product data with data for available inventory from a supplier.  In this case, the supplier didn't provide a feed, but simply provided access to its MS SQL Server database, which meant that I had to connect to the database, query the table for new and changed records, and determine which records had been deleted.  The trick in all this is connecting from a *nix system to a Microsoft database.  On a Windows PC, I would just define an ODBC connection, but since that capability does not exist natively in *nix, it needs to be added.

continue reading >>

Sep 4