Drupal 8: Delete view programmatically

If you should run into the same situation, that you'd like to delete a view programmatically, for example on module uninstall, here you go:

  1. \Drupal::service('config.factory')->getEditable('views.view.' . $view_name)->delete();

Comments

Thanks a lot, it helped me.

Thanks a lot, it helped me.

Post new comment

The content of this field is kept private and will not be shown publicly.

More information about formatting options