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.