The domain is not being configured on the homepage created when you create the subdomain

Created on 30 May 2023, over 1 year ago

Problem/Motivation

When we create a new domain, a homepage is automatically created. This action comes from the domain_sites module. Currently when creating the new domain the homepage is not being configured for the new domain.

Steps to reproduce

Create a new domain and go to the new page created as your homepage. If your site has other language instead NL as your default language, the homepage will not be set up correctly.

Proposed resolution

We have a class to create the homepage. There we have a static value to the language. We need to change this for a function that return the correct default language of the site.

Remaining tasks

Create patch
Review patch

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇵🇹Portugal developer-rocha

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @developer-rocha
  • 🇵🇹Portugal developer-rocha

    The patch for this.

  • Issue was unassigned.
  • Status changed to Needs work over 1 year ago
  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    Hi @developer-rocha, thanks for the report of this issue. It is indeed a bad decision and coding from me that i hardcoded it to 'nl'.

    But you should get the language from the configured content type rather than the sites default language.
    Something in the line of:

    $entityTypeManager = \Drupal::service('entity_type.manager');
    $content_type = $entityTypeManager->getStorage('node_type')->load($type);
    $default_language = $content_type->get('langcode');
    

    Get the language from the content type. Needs a little testing tho to make sure it works with all settings on the content type.
    So when no language is passed, fall back to the sites default language.

  • 🇵🇹Portugal developer-rocha

    Hi @tim-diels, you are welcome!

    As we talked privately, your suggestion to remove the language form solved the problem.

    • tim-diels committed 6a5973e3 on 1.0.x
      Issue #3363504 by developer-rocha, tim-diels: The domain is not being...
  • Status changed to Fixed over 1 year ago
  • 🇧🇪Belgium tim-diels Belgium 🇧🇪

    Thanks, looking good. Committed.

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

Production build 0.71.5 2024