Config split patches for views do not remove handlers

Created on 22 December 2022, over 2 years ago
Updated 16 January 2023, about 2 years ago

Problem/Motivation

When there is a view that is partially splitted, and in the partial split a views handler needs to be removed, the handler does not get removed and appears as broken.

This happens in a multi-site where one handler is removed for specific site requirements.

Steps to reproduce

- Create a view in default configuration
- Create a config split that marks this view as partial split.
- Remove a handler and export this change to the config split.

Now, import this new configuration in one of these:
- Other environment that does not have the new configuration
- The same environment but with the a database loaded that does not have this new configuration.

Proposed resolution

Implement hook_config_schema_info_alter so that the handler mapping schema has the 'plugin_id' as the patch index. Example with view sorts:

/**
 * Implements hook_config_schema_info_alter().
 */
function mysite_config_config_schema_info_alter(&$definitions) {
  if (isset($definitions['views_sort'])) {
    $definitions['views_sort']['settings']['patch index'] = 'plugin_id';
  }
}

With this, throw a exception into the mergeArray method at ConfigPatchMerge and capture it with a try/catch so that if a mapping configuration does not have its patch index, it gets removed from $result.

Remaining tasks

- Tests.
- Check if the config split generated patch contents are still correct, as the current solution only acts in the configuration import process and not in the configuration export.

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇪🇸Spain omarlopesino

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024