Disable views page programmatically

Public

Get raw version
php
  1. /**
  2.  * Disable My views.
  3.  */
  4. function hook_update_7001() {
  5. $viewnames = array(
  6. 'my_views_1',
  7. 'my_views_2',
  8. );
  9. $views_status = variable_get('views_defaults', array());
  10. foreach ($viewnames as $key => $viewname) {
  11. $views_status[$viewname] = TRUE;
  12. }
  13. variable_set('views_defaults', $views_status);
  14. if (function_exists('views_invalidate_cache')) {
  15. views_invalidate_cache();
  16. }
  17. }

Comments