# 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?

https://www.drupal.org/adyax

# 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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skrasulevskiy created an issue. See original summary.

skrasulevskiy’s picture

Assigned: Unassigned » skrasulevskiy
Issue summary: View changes
skrasulevskiy’s picture

FileSize
41.35 KB
andriic’s picture

FileSize
41.37 KB

Hello @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.

alexshipilov’s picture

alexshipilov’s picture

Assigned: skrasulevskiy » Unassigned
Status: Needs work » Needs review
mmjvb’s picture

This 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!

codesquatch’s picture

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

sebas5384’s picture

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

sebas5384’s picture

@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!

drclaw’s picture

@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

agentrickard’s picture

I'll try to review this week.

agentrickard’s picture

I 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?

Philalawst’s picture

Thanks 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 ?

j.b’s picture

Hello, 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 ?

mmjvb’s picture

Status: Needs review » Needs work

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

j.b’s picture

I've created an issue on the module page.

@sebas5384 i'm using your version, any idea why i'm getting this error ?

Thanks.

drclaw’s picture

In 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

Vlad_Bo’s picture

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

$properties = [
  'source' => '/' . $entity->toUrl()->getInternalPath(),
  'language' => $langcode,
  'domain_id' => $domain_id,
];

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.

drclaw’s picture

@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! :)

j.b’s picture

Hello,

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.

Londova’s picture

@drclaw

I installed your modules and tried to use for Commerce Products but without success. Would you give any instructions?
Thanks

skrasulevskiy’s picture

Hello @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.

skrasulevskiy’s picture

Status: Needs work » Needs review
mmjvb’s picture

Status: Needs review » Needs work
skrasulevskiy’s picture

Status: Needs work » Fixed

I've changed status to fixed as 8.x-1.0-beta1 was uploaded.

mmjvb’s picture

Status: Fixed » Needs review

For a beta it should be Needs review.

apaderno’s picture

Issue summary: View changes
Priority: Minor » Normal
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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