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;
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3293484-4.patch | 2.11 KB | arunkumark |
Issue fork domain_theme_switch-3293484
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:
- 3293484-error-building-configuration
changes, plain diff MR !1
Comments
Comment #2
abrammHi,
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.
Comment #5
arunkumarkCreated PR to resolve the issue. Here is the patch.
Comment #6
abrammHi 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?
Comment #7
arunkumark@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/...
Comment #8
antonio.bertolini commentedThanks 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!
Comment #9
joelpittetThere 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?
Comment #10
antonio.bertolini commented@joelpittet: I don't know how to mark RTBC...
Comment #11
abrammRevised the patch from #7, cherry-picked only related changes. Committing to 8.x-1.x.
Comment #13
abramm