Closed (fixed)
Project:
Masquerade Field
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2024 at 14:02 UTC
Updated:
22 Aug 2025 at 15:19 UTC
Jump to comment: Most recent
Hello project maintainers,
This is an issue to help make this module compatible with Drupal 11.
Will send a merge request that remove Drupal 11 deprecated method getEntityTranslation() of class Drupal\views\Plugin\views\field\LinkBase and default_argument_skip_url.
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
ahhua commented(updated issue summary)
Comment #4
ahhua commentedI think my merge request is ready for review now, I know there are failing tests but they were failing before my patch.
Comment #5
ahhua commented(unassigned myself)
Comment #6
mparker17I've reviewed the code changes in the merge request, and it looks good to me.
I ran some manual tests (documented below) of the basic functionality on the code in !4 and Drupal 11, and I was able to get it to work.
Here's what I did to test !4...
git clone --branch '2.x' https://git.drupalcode.org/project/masquerade_field.git && cd masquerade_field/- clone the projectgit remote add masquerade_field-3495033 git@git.drupal.org:issue/masquerade_field-3495033.git && git fetch masquerade_field-3495033- add a remote for the issue forkgit checkout -b '3495033--drupal-11' --track masquerade_field-3495033/'3495033--drupal-11'- switch to the branch for merge request !4ddev config --project-type=drupal --docroot=web --php-version=8.3 --corepack-enable --project-name=masquerade-field- create a ddev project for testing the moduleddev add-on get ddev/ddev-drupal-contrib && ddev start && ddev poser && ddev symlink-project- run the setup steps for the ddev/ddev-drupal-contrib addonhttps://masquerade-field.ddev.site/core/install.phpin a browser. Confirm that I saw the Drupal 11.1.0 installer. Install the site with the "Standard" install profile./admin/people/createand create a user with the Content editor role. I gave mine the usernametest_editor./admin/people/createand create a user with the Authenticated role. I gave mine the usernametest_user./admin/modulesand install masquerade_field and its dependencies/admin/people/permissions, grant the Content editor role the following permissions:... click Save permissions
test_editorContent editor user created earlier./user/2/edit). You see a Masquerade as field.test_editorinto the Masquerade as autocomplete, and select it from the autocomplete drop-down (on my test site, that made it saytest_editor (2).test_userinto the Masquerade as autocomplete, and select it from the autocomplete drop-down (on my test site, that made it saytest_user (3))test_editoruser created earlier; and log in as the administrator again/admin/reports/dblogto ensure our setup/testing did not result in any error messages related to this module.Comment #7
ajetiv1Is there a patch for Drupal 11, or will there be a new version release at some point
Comment #8
mparker17@ajetiv1, for now, the changes are in merge request !4, attached to this issue.
If you'd like a patch (e.g.: for Composer), there are instructions to download a patch in the Using GitLab to contribute to Drupal documentation on Downloading a patch file.
Comment #10
dimilias commentedI have further fixed the failing test, added the new hooks mechanism of D11.1+ and fixed codesniffs and phpstan.
Requesting one more review.
Comment #11
andrew.wang commentedI've tested one more time using steps in #6:
✅ Install ddev (I tested on version 1.24.6)
✅ Clone the module, issue fork, and branch:
✅ Set up a test site for the module with the ddev/ddev-drupal-contrib plugin:
✅ ddev config --project-type=drupal --docroot=web --php-version=8.3 --corepack-enable --project-name=masquerade-field - create a ddev project for testing the module
✅ ddev add-on get ddev/ddev-drupal-contrib && ddev start && ddev poser && ddev symlink-project - run the setup steps for the ddev/ddev-drupal-contrib addon
✅ Go to https://masquerade-field.ddev.site/core/install.php in a browser.
Confirm that I saw the Drupal 11.1.0 installer(I tested on 11.2.2). Install the site with the "Standard" install profile.✅ Go to /admin/people/create and create a user with the Content editor role. I gave mine the username test_editor.
✅ Go to /admin/people/create and create a user with the Authenticated role. I gave mine the username test_user.
✅ Set up the module for testing:
✅ Go to /admin/modules and install masquerade_field and its dependencies
✅ Go to /admin/people/permissions, grant the Content editor role the following permissions:
✅ Masquerade Field -> Edit the masquerade field
✅ Masquerade Field -> View any masquerade field
✅ Masquerade Field -> View own masquerade field
✅ User -> View user information
✅ ... click Save permissions
✅ Test the basic module functions in Drupal 11:
✅ Log out of the administrator account, and log in as the test_editor Content editor user created earlier.
✅ Go to the edit tab for the test_editor account (on my test site, it was at /user/2/edit). You see a Masquerade as field.
✅ Enter test_editor into the Masquerade as autocomplete, and select it from the autocomplete drop-down (on my test site, that made it say test_editor (2).
✅ Click Save at the bottom of the page.
✅ You see the error message User test_editor cannot masquerade as itself.
✅ Enter test_user into the Masquerade as autocomplete, and select it from the autocomplete drop-down (on my test site, that made it say test_user (3))
✅ Click Save at the bottom of the page.
✅ You see the status message The changes have been saved.
✅ Click the View tab at the top of the page.
✅ You see a Masquerade as field, with a link to masquerade as test_user.
✅ Click the test_user link to masquerade as the test_user.
✅ You see the status message You are now masquerading as test_user.
✅ Click the Unmasquerade link in the site header. If you can't see it, you may need to click the Menu button in the top-right corner of the page. If you're not using the Olivero theme, the Unmasquerade link may be located elsewhere.
✅ You see the status message You are no longer masquerading as test_user.
✅ Make sure there are no errors being logged:
✅ Log out of the test_editor user created earlier; and log in as the administrator again
✅ Go to /admin/reports/dblog to ensure our setup/testing did not result in any error messages related to this module.
Moving to RTBC again!
Comment #13
dimilias commentedThanks all.