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

Comments

mirsoft created an issue. See original summary.

mirsoft’s picture

Status: Active » Needs review
StatusFileSize
new670 bytes
kingdutch’s picture

Status: Needs review » Needs work

Functionally 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 ().

mtodor’s picture

Status: Needs work » Needs review
StatusFileSize
new3.81 KB
new6.32 KB

Thank 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.

The last submitted patch, 4: 3089823_4_test_only.patch, failed testing. View results

mtodor’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the review.

  • mtodor authored 370defd on 8.x-1.x
    Issue #3089823 by mtodor, mirsoft, Kingdutch, daniel.bosen: Delete...
mtodor’s picture

Status: Reviewed & tested by the community » Fixed
mtodor’s picture

Thanks everyone for contributions! Fix for delete action is merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.