If delete action is not followed by change action, item deletion is not performed because Updater::updateConfig() function prematurely returns.
Example (assuming we have a field_field_example attached to a node as a starting point):
core.entity_form_display.node.page.default:
expected_config: { }
# does not work without a patch, because "change" action is not present
update_actions:
delete:
content:
field_field_example: 0
core.entity_view_display.node.page.default:
expected_config: { }
# this works as there is delete action followed by a change action
update_actions:
change:
content:
body:
weight: 150
delete:
content:
field_field_example: 0
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3089823_4.patch | 6.32 KB | mtodor |
| #4 | 3089823_4_test_only.patch | 3.81 KB | mtodor |
| #2 | 3089823-2-fix-delete-action.patch | 670 bytes | mirsoft |
Comments
Comment #2
mirsoft commentedComment #3
kingdutchFunctionally this looks and works well. However, there are some coding standards issues that need work: https://www.drupal.org/pift-ci-job/1447430
Notably: The comment is more than 80 characters and there is incorrect whitespace in the ().
Comment #4
mtodor commentedThank you for reporting the issue and the patch.
I have looked at it and I have figure out that way how the update is applied is a bit messy and two places. So I have restructured functionality a bit in order to have a better split of responsibilities between functions.
PR is provided here: https://github.com/BurdaMagazinOrg/module-update_helper/pull/19
I have also attached patches here if someone has time to check it.
Comment #7
mtodor commentedThanks for the review.
Comment #9
mtodor commentedComment #10
mtodor commentedThanks everyone for contributions! Fix for delete action is merged.