2

I'm aware that I can export and import a Views code. I'm wondering if there is a way to edit and add relationships or contextual filters of a current view within the code instead of the UI.

The reason is sometimes its just easier to add the code rather than drilling down to the relationship within the UI.

If not, I guess the workaround would be to export, then change, then import and overwrite. Not sure how this will effect the site if the views were created from a module installation.

  • If a module provided the View (in a hook_views_default_views), changes made to the view in code will reflect as you change the code. – AyeshK Dec 25 '14 at 3:31
  • if you're familiar with sql, then yes, you can alter the db call however you want through a preprocessor hook in Views, and affect other behaviour such as contextual filters, etc. – Geoff Dec 25 '14 at 11:45
3

An easy way to do this would be if you had the features module that will contain the code of the view. Otherwise this information is stored in the database. Simply enable the module, create a new feature and add your view to it. Then it will be stored in code for you to alter.

0

Thanks for the suggestion guys.

I think the easiest way to avoid heavy database manipulation or adding different modules is to just export the view then change/add code and import and replace the view with newest changed version.

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.