Problem/Motivation
Enable Switch Page Theme to be installed on drupal 11
Steps to reproduce
Run upgrade status
Proposed resolution
Remove deprecated calls. Change version requirements.
Remaining tasks
Upgrade status reports:
1. web/modules/contrib/switch_page_theme/src/Form/SwitchPageThemeSettingForm.php 254 Call to deprecated function user_role_names(). Deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead.
2. web/modules/contrib/switch_page_theme/switch_page_theme.info.yml 5 Value of core_version_requirement: ^8 || ^9 || ^10 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | switch_page_theme-3489081-20.patch | 6.54 KB | bmunslow |
| #17 | switch-page-theme-3489081-17.patch | 1.88 KB | blasoliva |
| #2 | Switch-Page-Theme-3489081.patch | 1.43 KB | ananya.k |
Issue fork switch_page_theme-3489081
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
Comment #2
ananya.k commentedI have made the changes according to the upgrade status.
Please refer to attached patch.
Comment #8
shivam_tiwari commentedI am working here.
Comment #10
interlated commented@shivam_tiwari the config form /admin/config/system/switch_page_theme is crashing for me.
TypeError: strlen(): Argument #1 ($string) must be of type string, Drupal\user\Entity\Role given in strlen() (line 395 of /srv/web/electrifyingbradfield.org/web/core/lib/Drupal/Component/Utility/Unicode.php).
I've pushed a change. Convert 'Role' to a string as is commonly done in drupal core.
Comment #11
shivam_tiwari commentedThanks @dileepkumargembali. I added a commit on MR 7. I was getting error related to constructor on the the config form /admin/config/system/switch_page_theme.
Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /app/web/modules/switch_page_theme/src/Form/SwitchPageThemeSettingForm.php on line 55 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 43 of /app/web/core/lib/Drupal/Core/Form/ConfigFormBase.php).
Comment #12
shashi_shekhar_18oct commentedMR!8 Makes this module compatible with Drupal 11. Functionality is working as expected.
RTBC +1
Comment #13
shashi_shekhar_18oct commentedComment #14
rakesh.nimje84@gmail.com commentedFunctionality is working as expected.
RTBC +1
Comment #15
vivek panicker commentedHi @maintainers. Can we get this committed soon? We need to migrate a project to Drupal 11, and this module is blocking it.
Comment #16
stefan.kornHm, MR8 is not compatible with D11? Going to admin/config/system/switch_page_theme will result in WSOD. Should we hide that branch?
MR7 is compatible with D11, but the domain functionality is silently removed from the module? At least it should be explained why this is done.
Comment #17
blasoliva commentedI've attached the patch that fixes the issue with the settings form.
Could we get a new release that includes these changes?
Thank you
Comment #19
ksemihin commentedIn the forked MR, the composer.json file is missing.
Comment #21
bmunslow commentedPlease note MR9 was lacking in that it was missing the fix for the constructor issue which was already addressed in MR7.
As per the Drupal core backend backwards compatibility and internal API policy for constructors, the right way of fixing this is to avoid overriding the constructor in the first place.
Hence, instead of porting the fix from MR7, I have pushed a commit that fixes the issue by injecting needed service in the
createmethod.Attaching a static patch for convenience.
Comment #22
ryan-l-robinson commentedPatch worked for me, in combination with Drupal composer lenient to get it to install. Would still be nice to get this into a release for others to be able to update more easily.
Comment #23
onfire84 commentedI tried the changes from MR9. Looks like it works as expected. Please do a new release to fix the D11 compatibility.
Comment #24
naylor commented+1
Comment #25
aryan singh commentedI have used the patch in comment #21, it works fine and now the module appears to be Drupal 11 compatible.
Please review and merge.Thanks
Comment #26
aryan singh commentedComment #27
aryan singh commentedI have tested the patch in #21, it works fine and the module now appears to be compatible for Drupal11.