It would be great to have a Drupal 8 version of this module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

theapi created an issue. See original summary.

theapi’s picture

Here's a patch to get started created by David Grayston and myself.

agentrickard’s picture

Patch review really won't work here. There is too much code.

Do you want access to the Git repo to add this new code?

theapi’s picture

orbistertius’s picture

Is there any news on a Drupal 8 version? Perhaps I will not help out as a developer but the company I am working for might help to pay a person releasing a working 8 version...

agentrickard’s picture

I don't think anyone is working on it. The last discussion was at https://github.com/agentrickard/domain/issues/290

Andy Tawse’s picture

Hi,

Using the patch above, plus another change (to make the domain_id field unsigned, otherwise it could cope with one of my domain IDs), I have this working quite well. Thanks for that - it's very useful!

Just thought I'd add that here for reference, even if development will be on github.

I also wrote a migration (in domain_path_install()) to move existing aliases over to the new table. This is specific to my project though, as we had an existing site (with Domain installed from the beginning) and have just added a second (along with domain_path) so wanted all the existing aliases to be associated with the first domain.

My project is ongoing though so I'm sure I'll find more improvements in the coming weeks. I can't see anywhere on the github repo to contribute though - I don't think this module got added on there?

thanks

cburschka’s picture

Installing the patched module apparently breaks the site if no domains have been set up yet. The error is:

Error: Call to a member function getDomainId() on null in Drupal\domain_path\AliasStorage->getDomainId() (line 52 of modules/contrib/domain_path/src/AliasStorage.php).
Drupal\domain_path\AliasStorage->getDomainId() (Line: 254)
Drupal\domain_path\AliasStorage->lookupPathSource('/node', 'de') (Line: 169)
Drupal\Core\Path\AliasManager->getPathByAlias('/node') (Line: 35)

(Though to be fair, the domain module doesn't document that getActiveDomain() may return NULL, either.)

cburschka’s picture

FileSize
619 bytes

Here is a small patch that checks the return value of getActiveDomain() before calling it.

An alternative would be for the parent module to define a fallback domain object, but this fix is much simpler.

(I'll also be working with this code over the next few weeks; internally for now but I'll be happy to contribute upstream once there is a branch here or on github.)

cburschka’s picture

The schema issue encountered by Andy in #7 is indeed a bug - domain_id is an unsigned 32-bit integer (on platforms that support them). The database table must also use an unsigned integer column there, or it overflows 50% of the time.

agentrickard’s picture

Is anyone interested in maintaining this code as a separate project?

I'm trying to decide how best to manage it. It may introduce too much overhead to be in the main module bundle.

anydigital’s picture

@agentrickard, I am interested!

My new project will rely heavily on its functionality! And I also have a "Domain Path Rewrite" (https://www.drupal.org/project/domain_path_rewrite) module which is a good candidate to be ported/merged in D8.

agentrickard’s picture

@tonystar

I've given you Git access and other permissions to administer the project.

Fell free to start an 8.x-1.x branch and tag me in any issues you want reviewed.

andriic’s picture

check our implementation of domain_path for d8
https://www.drupal.org/node/2878050

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.

anydigital’s picture

Thanks for pointing- I'll review. Feel free to ping me in Facebook or Drupal Slack.

anydigital’s picture

cburschka’s picture

Side note: If this code will be abandoned in favor of a rewrite (eg at #2878050: [domain_path] Domain Path or https://drupal.org/project/domain_path_rewrite), this won't matter, but I discovered another bug in the last patch.

The hook_module_implements_alter function reorders hooks to ensure its field hooks override pathauto, but doesn't do so for field_info_alter. This breaks domain aliasing when pathauto is installed, applying the alias only to the current domain rather than the ones selected for the node.

drclaw’s picture

Here's a d8 port of this module that I put together based on some of the work & discussion in https://www.drupal.org/node/2878050

https://www.drupal.org/sandbox/ceastwood/2932431

  • Supports per-domain url aliases
  • Allows multiple nodes/entities to have the same alias as long as they are on different domains
  • Uses simple inbound/outbound path processing without issuing redirects (similar to how the path module handles aliases)
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? We used it on several our projects and it works fine. We are ready to upload code for 8.x version and support it if you provide us with access to Git repo.
Thanks.

agentrickard’s picture

I don't see any test coverage.

I am particularly interested in tests of Domain Path when used with Domain Alias and Domain Source, both of which can change the base url.

skrasulevskiy’s picture

Hello @agentrickard,
we added test coverage for module here - https://github.com/Adyax/domain_path. Could you check it out, please?
Thanks.

agentrickard’s picture

Nice.

I gave you -- @skrasulevskiy -- write access and permissions to release code.

  • skrasulevskiy committed e783cf6 on 8.x-1.x
    Issue #2821633 by skrasulevskiy: Drupal 8 version of this module
    
skrasulevskiy’s picture

Thanks @agentrickard,
we added 8.x-1.0-beta1 version of module: https://www.drupal.org/project/domain_path.

agentrickard’s picture

Version: 7.x-1.x-dev » 8.x-1.0-beta1
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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