Part of the Views ecosystem · 280 projects
This module provides tools to easily clean up and manage Views, such as removing specific filters or replacing them with new configurations. It can also help with cleaning up View dependencies when uninstalling modules.
This module is initally created for helping uninstall module: multiversion
Add some services to cleanup views easily
Services:
- views_cleanup.filter_cleanup
- views_cleanup.filter_replacement
- views_cleanup.filter_add
- views_cleanup.aggregate_views_filter_option
- views_cleanup.denpendencies
- views_cleanup.fields_cleanup
Examples
\Drupal::service('views_cleanup.filter_cleanup')
->cleanupViewsFiltersByFilterCheckOptions(['entity_field' => '_deleted']);
\Drupal::service('views_cleanup.denpendencies')
->cleanupViewsDependencyModules(['multiversion']);
$new_filter_config = [
'id' => 'deleted',
'table' => 'node_field_data',
'field' => 'deleted',
'relationship' => 'none',
'group_type' => 'group',
'admin_label' => '',
'entity_type' => 'node',
'entity_field' => 'deleted',
'plugin_id' => 'date',
'operator' => 'not empty',
'value' => ['min' => '', 'max' => '', 'value' => '', 'type' => 'date',],
'group' => 1,
'exposed' => FALSE,
'expose' => [
'operator_id' => '',
'label' => '',
'description' => '',
'use_operator' => FALSE,
'operator' => '',
'operator_limit_selection' => FALSE,
'operator_list' => [],
'identifier' => '',
'required' => FALSE,
'remember' => FALSE,
'multiple' => FALSE,
'remember_roles' => ['authenticated' => 'authenticated',],
'min_placeholder' => '',
'max_placeholder' => '',
'placeholder' => '',
],
'is_grouped' => FALSE,
'group_info' => [
'label' => '',
'description' => '',
'identifier' => '',
'optional' => TRUE,
'widget' => 'select',
'multiple' => FALSE,
'remember' => FALSE,
'default_group' => 'All',
'default_group_multiple' => [],
'group_items' => [],
],
];
\Drupal::service('views_cleanup.filter_replacement')
->replaceViewsFilterByFilterCheckOptions([
'entity_type' => 'node',
'entity_field' => '_deleted',
'operator' => '=',
'value' => '1',
], 'deleted', $new_filter_config);
Ask your assistant about Views Cleanup
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Views ecosystem
Most installed first
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.0.1 | Stable | 10 | Jan 26, 2025 | ||
| 2.0.x-dev | Dev | 10 | Jan 26, 2025 | ||
| 1.0.0-beta8 | Pre-release | 10 | Jan 17, 2024 | ||
| 1.0.0-beta7 | Pre-release | 10 | Jan 17, 2024 | ||
| 1.0.0-beta6 | Pre-release | 10 | Jan 16, 2024 | ||
| 1.0.0-beta5 | Pre-release | 10 | Jan 15, 2024 | ||
| 1.0.0-beta4 | Pre-release | 10 | Jan 15, 2024 | ||
| 1.0.0-beta3 | Pre-release | 10 | Jan 15, 2024 | ||
| 1.0.0-beta1 | Pre-release | 10 | Jan 15, 2024 | ||
| 1.0.x-dev | Dev | 8 | Jan 15, 2024 |