Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By asimov6 on
Hello,
I would like to get some expert's opinions on the following:
I need to create a specialized page in Drupal 7. Considering the hereafter mentioned requirements, do you think I should develop it using a custom module or use the Views module?
Requirements:
- The page should list a selection of data gathered from various external (non-drupal) tables
- The shown records will contain images
- Users should be able to filter data using selection criteria
- A table pager is required (preferable Ajax, degradable to non Ajax)
- Deleting multiple selected rows should be possible
- Various other actions on shown records (like jumps to detail view)
- Users don't have to be able to change the layout or functionality
- Programming experience is not an issue
- Maintainability is important
- Drupal 7 will be used
I'm hoping to get your much appreciated thoughts and advice.
Comments
Use a custom or contrib module to get your data exposed to VIews
In D6 there is the Data module (http://drupal.org/project/data) that can expose external data to Views. NOt sure when it will be upgraded to D7.
Views 3 has Query backend pluggable (http://drupal.org/node/646284)
"Right now Views only knows how to do SQL. But several very dedicated contributors have worked to move aside the query object so that it can be a plugin. What does this mean? Integration directly with Solr, FlickrAPI. Heck, any Restful API can be used. In theory this could mean integration with RDF ..."
The other approach, I am using, is to setup a custom module to import and sync data hourly (via cron) from an external (Oracle) database into individual nodes using node_save(). Once this is done, anything is possible, my synced nodes can now have relationships to other Drupal nodes and Views can be used to accomplish almost anything I need.
The only thing not addressed is allowing users to delete selected rows (aka nodes) and having the external database table also delete the row, this can be done using hook_delete($node).
To finally answer "do you think I should develop it using a custom module or use the Views module?". I would say use a custom module and/or a contrib module to get your data exposed to Views and let Views do the heavy lifting (aka programming) for you.
Thanks
Thanks for you input.
I have made a testpage using Views to get the things done. I think it could be done using Views, but sofar I do not really see the added value using views. While you can setup the basics very quickly using Views I suspect that when I want to add extra's I would end up programming anyway.
So I agree with you to go for a custom module.
It is worth trying to use Views...
It is worth trying to use Views whenever possible, even if you have to write custom Views display plugins. Views is designed to be re-usable and extend-able. Anything you think might be missing from Views has probably already been addressed by a contrib module or at least discussed in the issue queue and/or a blog post.
No matter which way you slice it, in Drupal, everything ends up requiring a little programming.
Another way to put it is every Drupal project requires a "custom module", the question is how "custom" does the module need to be.