
Web developers looking to offer a native app feel to their sites’ visitors will most likely consider using the single page app (SPA) approach. SPAs allow for a snappy user experience because redrawing parts of the page does not necessarily require a request to be made to the server. That said, the need occasionally does arise to make API calls from the single page app, and in such cases the app should show some indication to let the user know that something is happening in the background.
When I need to filter a view based on some elaborate condition, I often find myself using Drupal Views' contextual filters. Normally this kind of filter is supposed to pull the filter value from the URL, but it also lets you select other methods of finding a value if it’s not in the URL. For instance, if the filter is for the author, you can configure the view to use the current user’s ID. Even though this is very flexible, you may occasionally need filtering that cannot be set up with the available options. To overcome the limitations, you can add your own filtering logic by developing a…
In a recent post, I wrote about how we can group items in Solr search facets. This latest addition to the Solr post series will discuss how one can change the link text in Facet API’s Drupal blocks. Let’s assume I have a content type facet, as illustrated in the image below, and I wish to change the link text of the Discussion filter to Thread. Now, this sounds easy, right? One would think you could just implement hook\block\view\alter, and change the block’s content. However, this will turn out not to be the best approach. Even though this will allow you to manipulate the facet block’s…
Built-in Drupal pages and pages created by contrib modules have static paths that are hard-coded. An example of this would be /user where you can log in, or /node, which shows a list of recent nodes. Often times, we care about what the URL in the browser’s address bar looks like, and wish to change these. This post is a summary of three options to achieve this. Creating an alias Drupal has support for path aliases, which allows us to specify alternative paths for pages. This is the simplest solution and works in most cases. Some aspects of this solution that may be undesirable in certain…
It is common nowadays for Drupal sites to offload search duties to Solr by employing the Apache Solr Search and Facet API modules. Working together, these two modules can automatically build search facets that display filters for various aspects of the content, such as the content type, or taxonomy terms. In certain cases, it might be necessary to influence the way those facets filter content. This post will discuss a scenario where we may want to group multiple filters together inside a facet block such that they only appear as one item. This method may be useful if the site has too many…