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.
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.
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.
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.
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.
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.
I have worked on many other sites since I started working with Drupal four years ago, and other than my first blog site, I had never done one for myself. When I started SMGA a year ago, I knew I needed to get a site going for it, but between family and all the other sites I work on, I hadn't had the time to do it. The biggest issue for me was the theme. As a developer, and someone who is not gifted at creating designs, I needed to find one that I liked that I could convert to a Drupal theme. I had looked at literally hundreds of open source designs without seeing one I really liked, until one day, I saw a webcast by James Walker on theming, and as his example he used a theme from Styleshout. After looking through the themes, I finally came across one I liked call Cool Blue, and I decided to use it. It looks to be designed primarily for a blog site, but the page also provides examples of all styles used, so it's easy to adjust the front page.