Integrating remote data into Drupal 7 and exposing it to Views
Drupal's strength as a content management framework is in its ability to effectively manage and display structured content through its Web user interface. However, the out-of-the-box system assumes all data is local (stored in the database). This can present challenges when attempting to integrate remote data stored in other systems. You cannot, by default, display non-local records as pages. While setting this up is in itself a challenge, it is an even bigger challenge to manipulate, aggregate and display this data through Views.
This exposition is a follow-up to some excellent articles from years past:
- Larry Garfield's Remote Data in Drupal: Museums and the Web (2009)
- Florian Loretan's Remote entities in Drupal 7 (2012)
I'll discuss the history, explain where we are now, and then go through the process of setting everything up with the Remote Entity API and EntityFieldQuery Views Backend via examples and explanations. I'm also planning on leaving some time for discussion on alternative strategies and future plans, like how we can do this sort of thing in Drupal 8.
Here's a high-level overview:
- Introduction
- What's Changed
- Architecture
- Remote entity definition
- Access to remote properties
- Remote property definition
- Entity instances as Web pages
- Web services integration
- Temporary local storage
- Implementing the remote connection class
- ClientsRemoteEntityInterface implementations
- Parent overrides
- Local methods
- Implementing the remote query class
- Class variables and constructor
- Setting conditions
- Executing the remote query
- Unmarshalling the response data and returning it
- Error handling
- Views support
- Basic set-up
- Converting from an EntityFieldQuery
- Alternatives
- References