Block control faulty logic

Created on 10 May 2023, about 1 year ago
Updated 21 June 2023, about 1 year ago

Let's say I have two themes: "Main" (default theme) and "Subtheme". On primary site, Block Layout goes to /admin/structure/block, with "Subtheme" highlighted, but block list shows "Main" block assignments. This is wrong.

Changing the theme display to Main shows the correct assignments, assignments that were made before Domain was activated. (Note that URL is /admin/structure/block/list/"Main"). The URL construction indicates that /admin/structure/block/list/"Subtheme" is how to get to the subtheme block assignments - clicking on the Subtheme link goes to /admin/structure/block, which is wrong.

I went to /admin/structure/block/list/"Subtheme" and invoked a block used on the main site; the site threw an error, but the block was, indeed, saved, with collapsiblock working too. (See https://www.drupal.org/project/domain/issues/3358967 πŸ› Call to a member function setModuleOverride() errors Needs review ).

Trying to hide the page title (a core field) doesn't work at all, though, and the block order's not working properly either. Not sure what to do about that.

So a partial workaround for blocks seems to be manually entering the proper admin URL. For Views not saving (see issue link above), I believe the workaround is to disable Remember Domain Selection. And I guess the workaround for page title would have to be CSS. Clearing caches? Site crashes every time - gotta use Drush.

Jeez...

Hope this helps - thanks in advance!

πŸ’¬ Support request
Status

Active

Version

2.0

Component

- Domain Config UI

Created by

πŸ‡ΊπŸ‡ΈUnited States bcobin

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

Comments & Activities

  • Issue created by @bcobin
  • πŸ‡ΊπŸ‡ΈUnited States bcobin
  • πŸ‡ΊπŸ‡ΈUnited States bcobin
  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    Inspecting the domain configuration reveals the following:

    domain.config.[subdomain].domain_config_ui.settings
    This configuration is for the [sub] domain and applies to all languages.
    _core
    default_config_hash : PJP3-sJN2SQZTgCupMBEHry3ui7zsl93xtTovoTanFU
    remember_domain
    false
    path_pages
    /admin/appearance /admin/config/system/site-information /admin/appearance/settings /admin/appearance/font/settings

    Note the extra spaces after appearance, site-information and settings. That can't be right. Please advise... thanks!

  • πŸ‡ΊπŸ‡ΈUnited States bcobin
  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    I'm still getting the below in the logs with "site encountered an unexpected problem" every time I try to clear caches. Block operation is erratic and works only partially. Bootstrap dropdown nav menu doesn't work on affiliate site; it's just fine on the main site.

    So all in all, it seems that Domain isn't really usable at this point. But I'm in too far on this project to go back. Any suggestions greatly appreciated! (Again, I'm happy to demonstrate if you reach out to me privately.)

    Thanks in advance...

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "domain_content_editor" plugin does not exist. Valid plugin IDs for Drupal\views\Plugin\ViewsPluginManager are: domain, domain_access_admin, domain_access_editor, role, perm, none in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /[site]/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

  • πŸ‡©πŸ‡ͺGermany SteffenR Germany

    We just launched a larger site with domain and very specific block configuration for the different regional sites (in our case).
    The easiest way to overcome block placement problems, are subthemes per domain.
    Your base theme has all logic (like preprocessing, templates etc.) and the subthemes are set via domain_config.
    In our case, we had problems with domain_config_ui, that's why we added the according yml files manually.

    Simple example:
    domain.config.machine_name_of_domain.system.theme.yml
    default: subtheme_for_domain

  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    Thanks much for the suggestion! (It's been crickets on this.)

    But I'm not clear on exactly when you mean. I'm currently running a D7 domain multisite with over a dozen subsites, so I'm quite familiar with the system, but I've not been able to get Domain D10 working properly. For one thing, I crash every time I clear caches. (See #6.) Have you run into that? The block thing is a different, although I'm sure, related issue.

    In my case, the machine name of the subtheme is huntington_subtheme. (I have only one affiliate thus far and won't do more until it's working properly.)

    Are you saying I should create a domain.config.huntington_subtheme.system.theme.yml file with default: subtheme_for_domain as the only content in the file? If so, should that file go in the themes > custom > huntington_subtheme folder? Or should it go in the config > install or optional folder?

    Please LMK what you think - thanks again for the response!

  • πŸ‡©πŸ‡ͺGermany SteffenR Germany

    The domain.config config file (yml) needs to be placed in your config/sync directory.

    Depending on the machine name of your domain, the file needs to be named: domain.config.MACHINE_NAME_OF_DOMAIN.system.theme.yml and would only contain default: huntington_subtheme.

  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    Nope - no effect. I should also mention that I had to create the directory - the only two directories under config were and .

    And clearing caches crashes the site every time.

    Thanks for the suggestion - back to the drawing board on this - still not usable... :(

  • πŸ‡©πŸ‡ͺGermany SteffenR Germany

    The domain.config config file (yml) needs to be placed in your global ./config/sync directory of your drupal installation, where are other config is saved.
    Afterwards you need to run drush cim -y or import the new configuration via UI.
    Not sure, how your drupal site is configured, but usually you would use configuration management for config syncing/ updating etc..

  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    The domain.config config file (yml) needs to be placed in your global ./config/sync directory of your drupal installation, where are other config is saved.

    Thanks again for all the help, but I'm still unclear here. I'm on Drupal 10.0.9 and installation structure is web > core > install and schema - there is no sync directory, nor do I see any obvious .config files.

    There's a config folder for each theme -the bootstrap5 base theme, subtheme 1 (master theme) and subtheme 2 (1st affiliate).
    I'm on Drupal 10 - perhaps your setup is different? Again, thanks for taking the time...

  • πŸ‡©πŸ‡ͺGermany SteffenR Germany

    @bcobin:
    For further info about configuration management, you should read https://www.drupal.org/docs/administering-a-drupal-site/configuration-ma... β†’ .
    In our case we had to put the according config file manually in the config/sync folder, because the config_ui submodule messed up our domain specific config in some parts of the page (as already described) .

  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    You can also import the file at /admin/config/development/configuration/single/import

    For general updates for Drupal-10 compatibiilty, see the patch in πŸ“Œ Drupal 10.0.x Updates Fixed .

  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    Thank you! Sorry to sound like an idiot, but I want to get this straight:

    So I go to /admin/config/development/configuration/single/import - is this on the main site or on the affiliate(s)?

    (I'm thinking it would be each affiliate.)

    I select Single Item > Domain Record or Domain Alias?

    (I'm thinking Domain Record.)

    And then I simply paste in default: subtheme_for_domain

    Is that correct? I'm hoping this will fix the instability. (Drupal 7 just worked brilliantly.)

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    You have to know the name of the configuration you want to import and its type.

    Almost everything will be "simple configuration" and it should not matter from which domain you import.

    See the README file in domain_config (copied below). There are also sample files in the directory domain_config/tests/modules/domain_config_test/config/install/

    For instance, the file domain_config/tests/modules/domain_config_test/config/install/domain.config.four_example_com.system.site.yml

    name: 'Four'
    page:
      front: /node/2
    

    You would import that as "Simple Configuration" with name "domain.config.four_example_com.system.site"

    The pattern for override files is
    `domain.config.DOMAIN_MACHINE_NAME.LANGCODE.item.name`, with the backup for
    language-insensitive files as `domain.config.DOMAIN_MACHINE_NAME.item.name`,
    where `item.name` is the name of the configuration item being overridden.

    To override the site name, for instance, you begin by exporting the
    corresponding configuration item at the Configuration Synchronization screen
    for a single export:
    `admin/config/development/configuration/single/export`

    In this case, the type of configuration to be exported is "Simple
    configuration" and the particular item is named `system.site`.

    You should have a file like the following:

    ```YAML
    uuid: 536db351-7aec-407e-a746-70ba9cc9f190
    name: Example
    mail: admin@example.com
    slogan: ''
    page:
    403: ''
    404: ''
    front: /user
    admin_compact_mode: false
    weight_select_max: 100
    langcode: en
    default_langcode: en
    ```

    An override file should contain only the specific data that you want to
    override. To override the name, the only line needed is the one beginning
    ```name:```. The resulting override looks like this:

    ```YAML
    name: Three
    ```

    To override both the name and the slogan:

    ```YAML
    name: Three
    slogan: 'My site slogan'
    ```

    *Warning: do not copy over the `uuid` value into the new file. Doing so may
    cause the configuration import to fail.*

    We want this to apply when the domain `three.example.com` is active and English
    is the active language. Therefore, this file would be named
    `domain.config.three_example_com.en.system.site`. If we wanted this file to
    apply whenever the domain `three.example.com` is active, we would leave off the
    language prefix: `domain.config.three_example_com.system.site`.

    For further examples, see the files in
    `\domain\domain_config\tests\modules\domain_config_test\config\install`.

    Import that file's contents at the Configuration Synchronization screen for a
    single import:
    `admin/config/development/configuration/single/import`

    Note that, unlike when you exported the item, here you always select "Simple
    configuration" as the configuration type to import, independent of the type of
    configuration you're overriding.

  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    @agentrickard and @SteffenR,

    I am really sorry for taking up so much of your time. This is really embarrassing, but this is evidently beyond me and I'm completely lost.

    I tried placing the domain.config.huntington_subtheme.system.theme.yml with sole contents of default: subtheme_for_domain in the sync folder as described and I get The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.

    This is whether I access the setting from either the master or affiliate URL.

    I will pay for help here.

    I just need Domain to work as it does in D7. If this is the solution, the site won't crash whenever I try to clear caches and I can get on with creating the D10 version of the installation I've had running for many years now. If clearing caches still crashes the site (but the block assignments work), that's a step forward, but there's still work to do to get a stable setup happening.

    Again, thank you both immensely for taking the time - and my apologies for bugging you both. LMK what I need to do to put me out of my digital misery... thanks!

  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    I would need to see what those files contain -- there isn;t really any security issue in pasting it here.

    If the original file starts with this, the import would complain if you duplicated it. Simply remove it from the domain.* version.

    _core:
      default_config_hash: [SOME_STRING]
    
  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    Thanks for the response - again:

    I tried placing the domain.config.huntington_subtheme.system.theme.yml with sole contents of default: subtheme_for_domain in the sync folder as described

    default: subtheme_for_domain is all the file contains.

    I don't understand the relevance of the example files; as I've said, I'm completely lost here. But once again, the block issue is relatively minor; with the site crashing every time caches are cleared, my feeling is that the problem goes much deeper. See #6.

    I am willing to pay to resolve this - I really do think that's my only recourse a this point. if that's a possibility, please shoot me a message and we can take it from there... thanks!

    P.S. - I've been working with D7 Domain for years and am a HUGE fan, so this is very frustrating. Thanks for the work you do!

  • πŸ‡ΊπŸ‡ΈUnited States bcobin

    UPDATE: Things were so strange that I decided to rebuild the site from scratch using 2.0.0-beta1, which wasn't previously available.

    Overall behavior is much better, but there are major problems with blocks that I will open separate issues for.

    Thanks for all the suggestions!

Production build 0.69.0 2024