Skip to content

Instantly share code, notes, and snippets.

@init90
Created November 13, 2018 15:26
Show Gist options
  • Save init90/1dc7f30f83c7440a6b1bc75c47514386 to your computer and use it in GitHub Desktop.
Save init90/1dc7f30f83c7440a6b1bc75c47514386 to your computer and use it in GitHub Desktop.
Drupal 7, modify views filter settings programality.
$views_name = 'newest_products';
$display_name = 'page';
$filter_name = 'type';
// Add content type to allowed list in filter settings.
$view = views_get_view($views_name, TRUE);
$views_filters = $view->display[$display_name]->display_options['filters'];
$views_filters[$filter_name]['value'][$bundle_name] = $bundle_name;
$view->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment