I am using Drupal 7. What I want to do is to fetch the View 3 implementation from code, rather than from database, so that I can export my view, and put it in a function that would be available to all my team members w/o the need of importing the database script.


Take a look at hook_views_default_views().

Remember to implement hook_views_api() in mymodule.module file, so that views can find your views stored in code using hook_views_default_views().


There are quite some different ways to achieve this

  • Use the ctools bulk export module, this will provide you some example code to use
  • use the features module, which gives you a full module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.