drupal-7viewdefaultview

After changing a views default with hook_views_default_views_alter() how can I make it active programmatically?


I have a view. I altered it with hook_views_default_views_alter(). To make my changed become active I need to go to the UI and revert it back to the altered default.

How can I make the new default active programmatically instead?

In other words: How can I alter a views default and make it active programmatically?


Solution

  • I don't understand what you're asking, but it sounds like you want to revert the view.

    You need to include module_load_include('module', 'views') and module_load_include('inc', 'views', 'drush/views.drush'). And the function to revert all views views_revert_allviews(views_get_all_views());.

    Check function hook_views_default_views_alter for more info.