Managing drupal views in code

2,888 views

Published on

My presentation for Drupal Developers Day 2012 @ Microsoft Office in Ayala Makati, Philippines. This will show you how to save Drupal views in code and convert it to custom module.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,888
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Managing drupal views in code

  1. 1. The proper way ADOLFO G. NASOL
  2. 2. YESADOLFO G. NASOL
  3. 3. In DATABASE ADOLFO G. NASOL
  4. 4. ADOLFO G. NASOL
  5. 5.  Views can be stored in the database, which is typical of smaller sites and hobby sites. However, Views may also be stored directly in the code as "default" views, (which simply means theyre available by default). Modules often come with views that are specific to the module data, but its also possible -- and highly recommended -- that sites which have separate "development" and "production" sites export their views into default views in a site-specific module. This makes it very easy to transfer views from dev to production without making database changes. ADOLFO G. NASOL
  6. 6.  http://views- help.doc.logrus.com/help/views/api-default- views ADOLFO G. NASOL
  7. 7.  Less Database Query You can easily re-use your views You can versioned it, because it’s a code you can use Git or SVN to track changes. You can share it to community ADOLFO G. NASOL
  8. 8. ADOLFO G. NASOL
  9. 9. ADOLFO G. NASOL
  10. 10. ADOLFO G. NASOL
  11. 11.  You can use this to create a module to allow users to enable/disable certain website components or features generated by views. Just add hook permission, create menu and a settings page. Check the sample code at https://github.com/danreb/rswd_onepage Note: If you change or adjust your view, just re export the view and override your view file then go to view list page and click on revert. That’s it! Enjoy! ADOLFO G. NASOL
  12. 12.  Adolfo G. Nasol Mobile: 09195951276 Website : http://cavhost.com Blog: http://danreb.com Abtik Base Theme: https://github.com/danreb/abtik Abtik Outsource: http://abtikoutsource.com ADOLFO G. NASOL

×