Problem/Motivation
Although there is another issue open (
https://www.drupal.org/project/domain_path/issues/3285213
π
domain_path_pathauto creates duplicate aliases
Active
), and i have not tested its patch; this one might be a bit different as what i have notice is the module creates several aliases (one per domain set), when the field "field_domain_all_affiliates" is not added in the form display of the entity, as the code assumes "true" as its default value (and that is wrong if the field is not available in the form).
Also the code should not make TRUE as the default assumption in other places of the code AFAIK (the default value when added is false, therefore if the field is not added should be still false)
I have both domain_path and domain_path_pathauto modules enabled.
Steps to reproduce
1. Go to admin/structure/types/manage/page/form-display
and disable field Send to all affiliates
2. Create a new content of the page entity, where the "send to all affiliates" field is NOT present; making sure you have at least 2 domains added: choose one in "domain access", choose its domain in "domain source" (i think this can be skipped) AND enable the field "Generate automatic URL alias for ..." (should be only one domain there)
3. Go to /admin/config/domain_path
and verify one alias per domain has been created, although the other domain was not selected.
With the field added in the display_form and disabled, the behaviour is the expected one (only one alias)
Proposed resolution
Apply the MR, and repeat 1,2 and 3. Now there is only one alias added