HI,
in my drupal 9.4.1i've got this error:
TypeError: Argument 2 passed to Drupal\domain_theme_switch\Form\DomainThemeSwitchConfigForm::__construct() must be an instance of Drupal\domain_theme_switch\Form\EntityTypeManagerInterface, instance of Drupal\webprofiler\Entity\EntityManagerWrapper given, called in /modules/contrib/domain_theme_switch/src/Form/DomainThemeSwitchConfigForm.php on line 63 in Drupal\domain_theme_switch\Form\DomainThemeSwitchConfigForm->__construct() (line 45 of /modules/contrib/domain_theme_switch/src/Form/DomainThemeSwitchConfigForm.php)

googling, I solve applying this patch:

--- DomainThemeSwitchConfigForm.php
+++ DomainThemeSwitchConfigForm.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Entity\EntityTypeManager;
+use Drupal\Core\Entity\EntityTypeManagerInterface; 
 use Drupal\Core\Extension\ThemeHandlerInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
@@ -37,12 +38,12 @@
    *
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory load.
-   * @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
+   * @param \Drupal\Core\Entity\EntityTypeManagerInterface  $entity_type_manager
    *   The entity type manager.
    * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
    *   The theme handler.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManager $entity_type_manager, ThemeHandlerInterface $theme_handler
+  public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface  $entity_type_manager, ThemeHandlerInterface $theme_handler
   ) {
     parent::__construct($config_factory);
     $this->entityTypeManager = $entity_type_manager;
CommentFileSizeAuthor
#7 3293484-4.patch2.11 KBarunkumark
#5 3293484-4.patch0 bytesarunkumark
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

antonio.bertolini created an issue. See original summary.

abramm’s picture

Title: Config error » Error building configuration form with webprofile module enabled
Status: Active » Needs work

Hi,

While this change totally makes sense, it's worth noting that according to the trace the error happens because of incompatibility with the webprofiler module.

Thus, another possible workaround would be disabling the webprofiler.

The next actionable task would be making a patch file and I'd also like to check if there are other references to classes which we could replace with interfaces.

arunkumark made their first commit to this issue’s fork.

arunkumark’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

Created PR to resolve the issue. Here is the patch.

abramm’s picture

Status: Needs review » Needs work

Hi arunkumark,
The patch is empty so I don't think it would work.

Also did you have a chance to check if there are other references to the class (instead of interface) in code?

arunkumark’s picture

Status: Needs work » Needs review
StatusFileSize
new2.11 KB

@abramm
Verified only the File DomainThemeSwitchConfigForm.php having the class instead of the interface. Re-uploaded the patch file. Also, find the Merge Request link https://git.drupalcode.org/project/domain_theme_switch/-/merge_requests/...

antonio.bertolini’s picture

Thanks to all for the path!
abramm said:
"Thus, another possible workaround would be disabling the webprofiler."

... this error makes me crazy: in the meanwhile I install
https://www.drupal.org/project/prevnext
and I got the same error! :D

with this issue:
https://www.drupal.org/project/prevnext/issues/3277266

Thanks again!

joelpittet’s picture

Title: Error building configuration form with webprofile module enabled » Error building configuration form with webprofiler module enabled
Version: 8.x-1.5 » 8.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

There are some unrelated code fixes in there (which can break other people's patches) but the gist is of the patch is correct. Thanks for the contribution and again resist the urge to fix other issues.

Changing the branch to the dev branch because that is where it needs to apply. I'd suggest commiting the MR in #4, but thanks for the patch too. @arunkumark.

@antonio.bertolini if you've tested the other issue you cross-referenced could you mark as RTBC as well?

antonio.bertolini’s picture

@joelpittet: I don't know how to mark RTBC...

abramm’s picture

Revised the patch from #7, cherry-picked only related changes. Committing to 8.x-1.x.

  • 4dc05d7 committed on 8.x-1.x
    Issue #3293484 by arunkumark, antonio.bertolini, abramm, joelpittet:...
abramm’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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