Drupal: Enable or Disable a View in Deployment.

Drupal Hook Update Deploy Tools now (as of v 7.x-1.16) has the ability to enable or disable  a View from within a hook_update_N().  It handles validation to make sure that your request to enable or disable a View actually did what you asked it to do.

 

Add something like this to a hook_update_N in your custom deploy module.install
to enable some Views.

<?php
  $views
= array(
   
'some_view_machine_name',
   
'another_view_machine_name'
 
);
 
$message HookUpdateDeployTools\Views::enable('$views');

  return $message;
?>

To disable some Views, it looks like this:

<?php
  $views
= array(
   
'some_view_machine_name',
   
'another_view_machine_name'
 
);
 
$message HookUpdateDeployTools\Views::disable('$views');

  return $message;
?>

Here is an example of what your terminal would show after running the enable method above:

Terminal output running Drupal Hook Update Deploy Tools

section: