Drupal is a registered trademark of Dries Buytaert

views_cleanup

No security coverage
View on drupal.org

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

Activity

Total releases
2
First release
Jan 2025
Latest release
1 year ago
Release cadence
0 days
Stability
50% stable

Releases

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