Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Views Cleanup

No security coverage Drupal 10 · not 11 Views ecosystem
View on drupal.org

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);

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.

Activity

Tracked releases
2
Tracked since
Jan 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Core Release date
2.0.1 Stable 10 Jan 26, 2025
2.0.x-dev Dev 10 Jan 26, 2025