Problem/Motivation

The "Delete all aliases for this content" checkbox in the Domain Path module does not actually delete aliases when checked and the form is saved. The aliases remain in the path_alias table.

Steps to reproduce

  1. Create a node with "Send to all affiliates" checked
  2. Save the node - aliases are created for all domains
  3. Edit the node
  4. Change domain access to a single domain
  5. Check "Delete all aliases for this content"
  6. Click Save
  7. Expected: All domain aliases should be deleted
  8. Actual: Aliases are NOT deleted

Root Cause: In DomainPathHelper::submitEntityForm() (line 228), the code looks for form values at the wrong key:

$path_wrapper_values = $form_state->getValue('path_wrapper'); // WRONG

The actual form input name is domain_path_wrapper[domain_path_delete] (as defined in lines 79 and 84 for #states).

Proposed resolution

Change path_wrapper to domain_path_wrapper:

$domain_path_wrapper_values = $form_state->getValue('domain_path_wrapper'); // CORRECT

Remaining tasks

  • Review and merge the fix

User interface changes

None - fixes existing functionality.

API changes

None

Data model changes

None

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

momodou.jobe created an issue. See original summary.

mably made their first commit to this issue’s fork.

mably’s picture

Thanks @momodou.jobe for your MR. Added a functional test to avoid getting hit again in the future.

Test coverage for the fix

Added testDeleteAllAliasesDeletesEntities() to DomainPathNodeAliasTest. The existing test (testDeleteCheckboxDisablesAliasFields) only verified the client-side #states behavior — it never submitted the form or checked the database.

The new test:

  1. Creates a node with aliases on both domains
  2. Asserts 2 aliases exist in path_alias storage
  3. Edits the node, checks "Delete all aliases", submits
  4. Asserts 0 aliases remain

Verification

Confirmed the test catches the original bug:

  • With the fix (domain_path_wrapper): test passes — aliases deleted
  • With the bug (path_wrapper): test fails — Failed asserting that actual size 2 matches expected size 0

  • mably committed 79bc2479 on 3.x authored by momodou.jobe
    fix: #3576020 Delete all aliases for this content" checkbox does not...

  • mably committed f7b6757e on 2.x authored by momodou.jobe
    fix: #3576020 Delete all aliases for this content" checkbox does not...
mably’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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