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.

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

interlated created an issue. See original summary.

ananya.k’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

I have made the changes according to the upgrade status.
Please refer to attached patch.

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

dileepkumargembali changed the visibility of the branch 3489081-d11_ready to hidden.

shivam_tiwari’s picture

Assigned: Unassigned » shivam_tiwari

I am working here.

interlated’s picture

@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.

shivam_tiwari’s picture

Assigned: shivam_tiwari » Unassigned

Thanks @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).

shashi_shekhar_18oct’s picture

MR!8 Makes this module compatible with Drupal 11. Functionality is working as expected.

RTBC +1

shashi_shekhar_18oct’s picture

Status: Needs review » Reviewed & tested by the community
rakesh.nimje84@gmail.com’s picture

Functionality is working as expected.

RTBC +1

vivek panicker’s picture

Hi @maintainers. Can we get this committed soon? We need to migrate a project to Drupal 11, and this module is blocking it.

stefan.korn’s picture

Status: Reviewed & tested by the community » Needs work

Hm, 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.

blasoliva’s picture

StatusFileSize
new1.88 KB

I've attached the patch that fixes the issue with the settings form.

Could we get a new release that includes these changes?

Thank you

ksemihin’s picture

In the forked MR, the composer.json file is missing.

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

bmunslow’s picture

StatusFileSize
new6.54 KB

Please 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 create method.

Attaching a static patch for convenience.

ryan-l-robinson’s picture

Patch 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.

onfire84’s picture

I tried the changes from MR9. Looks like it works as expected. Please do a new release to fix the D11 compatibility.

naylor’s picture

+1

aryan singh’s picture

I 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

aryan singh’s picture

Status: Needs work » Needs review
aryan singh’s picture

Status: Needs review » Reviewed & tested by the community

I have tested the patch in #21, it works fine and the module now appears to be compatible for Drupal11.