Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
# Summary
The Domain Path module allows the creation of separate path aliases per domain for nodes created using the Domain Access module.
# Project URL
https://www.drupal.org/project/domain_path
# Where is the code?
https://www.drupal.org/project/domain_path/releases/8.x-1.0
# Estimated completion date
Unknown
# Dependencies
None
# Who's doing the port?
# What help do they need?
Now we are actively working on the project and we would be glad to get any help (as developing, testing, reviewing).
# D8 roadmap
Unknown
# Background and reference information
Comment | File | Size | Author |
---|---|---|---|
#10 | domain_path_different_entities.zip | 42.22 KB | sebas5384 |
#4 | domain_path_new.zip | 41.37 KB | andriic |
Comments
Comment #2
skrasulevskiy CreditAttribution: skrasulevskiy at Adyax commentedComment #3
skrasulevskiy CreditAttribution: skrasulevskiy at Adyax commentedComment #4
andriic CreditAttribution: andriic at Adyax commentedHello @agentrickard,
could you check port of domain_path module for Drupal 8, create branch 8.x and upload attached file, please?
This module provides creating separate aliases for entities per domain. It was testing with Node, Taxonomy term and User entities.
It is also provides possibility to create pathauto patterns per domains or a list of domains.
Thanks.
Comment #5
alexshipilov CreditAttribution: alexshipilov commentedComment #6
alexshipilov CreditAttribution: alexshipilov commentedComment #7
mmjvb CreditAttribution: mmjvb as a volunteer commentedThis is an issue in D8CPT, not the module itself. This issue is about the port of the module to D8.
The actual work needs to be done in the module itself. To add your work to the module, create an issue in the module issue queue, not here!
Comment #8
codesquatch CreditAttribution: codesquatch commentedYou said that you can have same urls for different pieces of content per domain? How is that done? Whenever I add the same url for two separate pieces of content for different domains I'm thrown access denied because the entity isn't changing to match the domain.
Comment #9
sebas5384 CreditAttribution: sebas5384 at Taller commented@sasquatch_codes I have the same issue, so I can confirm this is happening.
For now we are debugging it to know the cause of it, if we find something I'll come back here.
Comment #10
sebas5384 CreditAttribution: sebas5384 at Taller commented@sasquatch_codes we figure this out \o/
When I said we, it means me and @josephramos so credits to him too.
Here's a version modified to work with your (and our) case, were we have the same url alias for different entities and domains.
Thanks for the domain_path module's port, was almost 100% done. And since it's working we are going to use it in production.
oh! I tried to add some tests, but a single test run is taking more than 3 minutes, I think we should avoid BrowserTestBase, we could do everything with just KernelTestsBase once we could mock the entire Request.
Maybe later I'll create a PR at the github repo :)
Cheers!
Comment #11
drclaw CreditAttribution: drclaw commented@andrey_che @sebas5384, initial tests with this module port is looking good on my end! Is there a repository/branch on d.o or github started for it? I have a couple possible enhancements I'd like to patch/PR but can't find it anywhere :)
Thanks!
drclaw
Comment #12
agentrickardI'll try to review this week.
Comment #13
agentrickardI appreciate the work, and feel free to rename and release it, but I disagree with the whole approach here. We should not be writing headers and issuing commands to browsers.
Review notes:
* Pathauto and its dependencies should not be required. Path module should be required.
* Redirect should not be required.
* RedirectResponse likely needs to be TrustedRedirectResponse in all cases. E.g. DomainPathViewController::view().
* I don't like the dependency on Redirect module.
Why is the module even issuing redirects? The whole idea is to set the path on output so that we don't have to fuss with redirects. Path module doesn't issue redirects, so why would we? Using redirects increases the complexity of interactions with other modules and makes maintenance harder.
I would expect to see usage of Drupal\Core\PathProcessor\OutboundPathProcessorInterface instead, See DomainSourcePathProcessor for how the module design handles path and link rewrites.
Is there something inherent in Drupal 8 that forced you down the redirect route instead of rewriting links? Did you run into conflicts with Domain Source?
Comment #14
Philalawst CreditAttribution: Philalawst commentedThanks for the port of this module on drupal 8.
is There some evolution about the agentrickard's comments ?
Can I use the current version or it's not a good idea ?
Comment #15
j.b CreditAttribution: j.b commentedHello, the module works.
But there are some intermittent errors,
Some pages which have domain path alias sometimes fail with a fatal error (error: 500)
The error message obtained :
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "domain_path.local_tasks:domain_path.view.node" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of /../core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Each time the error occurs , i have to clear Drupal cache for it to go away.
Anyone can help ?
Comment #16
mmjvb CreditAttribution: mmjvb as a volunteer commentedConsider what is currently available a dev version and set Status accordingly to Needs work. See this project for info on the usage of Status.
@j.b Please move your support request to the project issue queue itself. This issue records the porting status.
Comment #17
j.b CreditAttribution: j.b commentedI've created an issue on the module page.
@sebas5384 i'm using your version, any idea why i'm getting this error ?
Thanks.
Comment #18
drclaw CreditAttribution: drclaw commentedIn response to @agentrickard's comments in #13, I've done a paired down version of the initial port without the redirects or pathauto stuff. Just some good ol' fashioned inbound and outbound path processing to get the job done. Figured I'd put it up in a sandbox for anyone who is interested: https://www.drupal.org/sandbox/ceastwood/2932431
Comment #19
Vlad_Bo CreditAttribution: Vlad_Bo commented@drclaw nice work, but there is fatal error if I'm trying to add new node in alterEntityForm() because there is no node url at that moment.
Probably you need to add some check like if ($entity_id) {blabla}.
And maybe it's better to move alterEntityForm code to widget like it's done in PathautoWidget.
Comment #20
drclaw CreditAttribution: drclaw commented@Vlad_Bo Thanks for the review! Obviously didn't test it well enough myself before posting :|
I've updated the sandbox to fix those fatal errors. Also I really like your suggestion of using a field widget. I took a look at the path module field widget and I think I can pretty much use the exact same technique. Thanks for that! :)
Comment #21
j.b CreditAttribution: j.b commentedHello,
Anyone can help on the error that i'm getting ?
https://www.drupal.org/project/contrib_tracker/issues/2878050#comment-12...
The error occurs very randomly, after saving / updating nodes.
Any help will be appreciated,
Thank you.
Comment #22
Londova CreditAttribution: Londova commented@drclaw
I installed your modules and tried to use for Commerce Products but without success. Would you give any instructions?
Thanks
Comment #23
skrasulevskiy CreditAttribution: skrasulevskiy at Adyax commentedHello @agentrickard,
could you check reworked version of the "domain_path" module for Drupal 8 - https://github.com/Adyax/domain_path based on Adyax team work (https://github.com/onesixromcom/domain_path) and @drclaw (https://www.drupal.org/sandbox/ceastwood/2932431 - dependencies from the redirects and pathauto were removed and used inbound/outbound paths staffs as was mentioned here - https://www.drupal.org/project/contrib_tracker/issues/2878050#comment-12...), please?
Thanks.
Comment #24
skrasulevskiy CreditAttribution: skrasulevskiy at Adyax commentedComment #25
mmjvb CreditAttribution: mmjvb as a volunteer commentedComment #26
skrasulevskiy CreditAttribution: skrasulevskiy at Adyax commentedI've changed status to fixed as 8.x-1.0-beta1 was uploaded.
Comment #27
mmjvb CreditAttribution: mmjvb as a volunteer commentedFor a beta it should be Needs review.
Comment #28
apaderno