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
- Create a node with "Send to all affiliates" checked
- Save the node - aliases are created for all domains
- Edit the node
- Change domain access to a single domain
- Check "Delete all aliases for this content"
- Click Save
- Expected: All domain aliases should be deleted
- 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'); // WRONGThe 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'); // CORRECTRemaining tasks
- Review and merge the fix
User interface changes
None - fixes existing functionality.
API changes
None
Data model changes
None
Issue fork domain_path-3576020
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
Comment #4
mably commentedThanks @momodou.jobe for your MR. Added a functional test to avoid getting hit again in the future.
Test coverage for the fix
Added
testDeleteAllAliasesDeletesEntities()toDomainPathNodeAliasTest. The existing test (testDeleteCheckboxDisablesAliasFields) only verified the client-side#statesbehavior — it never submitted the form or checked the database.The new test:
path_aliasstorageVerification
Confirmed the test catches the original bug:
domain_path_wrapper): test passes — aliases deletedpath_wrapper): test fails —Failed asserting that actual size 2 matches expected size 0Comment #8
mably commented