Multisite setup ignore theme

Created on 23 January 2018, about 7 years ago
Updated 4 October 2024, 6 months ago

The problem that i have at the moment is that i have a multsite setup with themes per site.
say like:
/web/themes/custom/base_theme

/web/sites/example-site-1/themes/theme-1
/web/sites/example-site-2/themes/theme-2
/web/sites/example-site-3/themes/theme-3

This theme is then enabled per site. The problem i face with exporting te config is that i can greylist the system.theme but it still show up in the core.extensions. Because of this i need te enable all themes on all sites which isn't possible because they are site specific. The behavior of themes should the be like a module so it doesnt show up in the core.extensions. Does anyone have an idea how to do this?

✨ Feature request
Status

Needs work

Version

2.0

Component

User interface

Created by

πŸ‡³πŸ‡±Netherlands nickvanboven

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡΄Norway steinmb

    Move back to NW due to MR still have no tests.

  • Up to this point I have succesfully used the following:

    function hook_form_config_split_edit_form_alter(&$form, &$form_state, $form_id) {
      // Support both old and new versions of the module
      if (isset($form['blacklist_fieldset']['theme'])) {
        $form['blacklist_fieldset']['theme']['#access'] = TRUE;
      }else{
        $form['complete_fieldset']['theme']['#access'] = TRUE;
      }
    }
    

    This no longer seems to work after I followed the upgrade path to Drupal 10.2 and version 2.0 of config_split.
    I am not sure whether this broke due to the updates that have been applied to the database, or because the code works differently now.
    The patch of the merge request also still applies, so I don't know what is wrong, but all sites in the multisite system now no longer seem to understand that a different theme should be used.

    I am investigating this, but maybe some one already knows the answer / has a solution?

  • First commit to issue fork.
  • Pipeline finished with Success
    6 months ago
    Total: 248s
    #300854
  • πŸ‡ΊπŸ‡ΈUnited States dasginganinja Bethlehem, PA

    I used the code from @Paul Dudink above with Config Split 2.0.2 to enable the theme box that there is support for? This was hidden behind an access false and it worked fantastically for our use case.

    /**
     * Implements hook_form_FORM_ID_alter().
     */
    function hook_form_config_split_edit_form_alter(&$form, &$form_state, $form_id) {
      // Support for version 2 of the module.
      if (isset($form['complete_fieldset']['theme'])) {
        $form['complete_fieldset']['theme']['#access'] = TRUE;
      }
    }
    

    For Paul's issue above I'd be curious if his theme issues are due to a weighting of the theme names. My assumption would be that your base theme should be lexicographically sorted first before your other themes to avoid issues.
    theme_base before theme_subtheme sort of thing, ya dig?
    If you have a situation where you have `subtheme` and then `theme_base` I'd try to avoid that based on my past experiences with Drupal module default weight ordering.

    Good luck all.

Production build 0.71.5 2024