Problem/Motivation
Hello project maintainers,
This is an automated issue to help make this module compatible with Drupal 10.
To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects
Periodically patches will be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted simply close this issue (any status besides Active, Needs review or Needs work) or remove the "ProjectUpdateBotD10" tag from the issue.
The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.
Proposed resolution
You have a few options for how to use this issue:
- Accept automated patches until this issue is closed
If this issue is left open (status of Active, Needs review or Needs work) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.
As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.
- Leave open but stop new automated patches.
If you want to use this issue as a starting point to remove deprecated API uses but don't want new automated patches simply leave this issue open but remove the "ProjectUpdateBotD10" tag from the issue.
You can use Drupal Rector yourself to make these patches.
If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.
- Close it and don't use it
If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review or Needs work) and no more automated patches will be posted here.
If the issue is reopened, then new automated patches will be posted.
If you are using another issue(s) to work on Drupal 10 compatibility it may be useful to other contributors to add those issues as "Related issues" when closing this issue.
Remaining tasks
Using the patches
- Apply the patch in the comment by Project Update Bot.
- Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
Providing feedback
If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Infrastructure project issue queue using the component “Bot: Drupal Rector”.
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | 3288686-42.patch | 7.49 KB | renatog |
| #38 | Drupal-10-upgrade-status-94 (3).png | 25.93 KB | yashingole |
| #38 | Modals-10.png | 57.5 KB | yashingole |
| #38 | Edit-Thank-you-for-installing-Modal-Page-10.png | 226.44 KB | yashingole |
| #37 | 3288686-37.patch | 9.06 KB | Ankit.Gupta |
Issue fork modal_page-3288686
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
project update bot commentedThis is an automated patch generated by Drupal Rector. Please see the issue summary for more details.
It is important that any automated tests available are run with this patch and that you manually test this patch.
Drupal 10 Compatibility
According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.
Currently Drupal Rector, version 0.12.0, cannot fix all Drupal 10 compatibility problems.
This patch does not update the
info.ymlfile for Drupal 10 compatibility.Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.
Debug info
This patch was created using these packages:
Comment #3
project update bot commentedThis is an automated patch generated by Drupal Rector. Please see the issue summary for more details.
It is important that any automated tests available are run with this patch and that you manually test this patch.
Drupal 10 Compatibility
According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.
Currently Drupal Rector, version 0.13.0, cannot fix all Drupal 10 compatibility problems.
This patch does not update the
info.ymlfile for Drupal 10 compatibility.Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.
Debug info
This patch was created using these packages:
Comment #4
vitorbs commentedI will try to work on that.
Comment #5
vitorbs commentedI reviewed and applied the remaining necessary changes, so now just need to review it again.
Comment #6
vitorbs commentedComment #7
paulocsI have done a review and there are some changes in the patch that have to be made:
1) In
modal_page/src/Form/ModalForm.phpshould be used dependency injection to call the service'extension.path.resolver'in$imagePath = $imageUrl = '/' . \Drupal::service('extension.path.resolver')->getPath('module', 'modal_page') . '/images/';.2) The service
'extension.path.resolver'was introduced in Drupal 9.3.0 (see: https://www.drupal.org/node/2940438). It means that thecore_version_requirement: ^8.8 || ^9 || ^10should be actuallycore_version_requirement: ^9.3 || ^10.3) In
modal_page.installfile, non static method 'getPath' should not be called statically. It should be changed to\Drupal::service('extension.list.module')->getPath('modal_page')Comment #8
vitorbs commentedComment #9
vitorbs commentedComment #10
vitorbs commentedComment #11
renatog commentedComment #12
lucasscComment #13
lucasscHi, I applied patch in #9 for branch 10.0.x and looks great!
Addressed to #7:
1) service 'extension.path.resolver' now is called with dependency injection;
2) core_version_requirement updated to ^9.3 || ^10 as requested;
3) 'getPath' method now is called via the generic \Drupal::service() method.
I found these simple coding standards problems introduced by the patch:
Adding a new patch to fix it.
I know it's not related but as we are going to edit line 88 of modal_page/src/Form/ModalForm.php:
$imagePath = $imageUrl = '/' . $this->extensionPathResolver->getPath('module', 'modal_page') . '/images/';Assign to both $imagePath and $imageUrl looks kind of weird to me and searches didn't revealed any occurrence of $imagePath usage later on, is there some reason to keep it?
Comment #14
paulocs1) Unused use statement
use Drupal\Core\Extension\ExtensionPathResolver;inmodal_page.installComment #15
reenaraghavan commentedComment #17
reenaraghavan commentedI applied patch in #13 for branch 4.1.x
Removed use statement use Drupal\Core\Extension\ExtensionPathResolver; in modal_page.install
Used Rector to fix code
Scanned module using "Upgrade Status" found few issues and have attached the screen shots.
Comment #18
reenaraghavan commentedComment #19
reenaraghavan commentedComment #20
vitorbs commentedComment #21
paulocsPlease don't fix any code standard problem in this issue.
It's out of the scope of this issue. Focus on Drupal 10 compatibility only
Comment #22
vitorbs commentedIm applying a new patch that remove the unused statement.
@reenaraghavan did you applied the patch correctly? When i scan the module using Upgrade Status it does not find any new issues as you can see in the screenshot.
@paulocs, i did all the changes you asked for.
Comment #23
vitorbs commentedComment #24
vitorbs commentedComment #25
reenaraghavan commented@paulocs, @vitorbsI am new to contributions, and sorry if I have done anything wrong.
Comment #26
paulocsYou did right @reenaraghavan. Thanks for your contribution :)
Hey @vitorbs, please work on the MR and check if all deprecated code was removed and properly replaced.
Now that @reenaraghavan opened a MR, we should keep working on the MR and not with patches :)
Comment #27
paulocsComment #28
vitorbs commentedok, i will work on the MR, thanks!
Comment #29
vitorbs commentedComment #30
vitorbs commentedI fixed the STATUS_PERMANENT deprecated functions that @reenaraghavan found on her scan.
Comment #31
vitorbs commentedComment #32
gquisini commentedI'll be reviewing this issue.
Comment #33
gquisini commentedHi,
Reviewing this issue took longer than I expected, because I had some problems with the update status module. But everything seems to be right, with no problems reported.
I am attaching two screenshots, with a before/after MR.
Comment #34
gquisini commentedComment #35
renatog commentedThank you so much for your amazing job, team! I'm updating the target to 5.0.x because I'm going to merge it into 5.0.x with Support to D10
Comment #36
renatog commentedI was going to merge this MR but new fixed were commited into 4.1.x and was necessary to move these fixes to the new version 5.0.x
After merge 4.1.x into 5.0.x this MR needs to be updated because some files were updated and can't be merged because of conflict, for example
js/modal-page.jsNow the branch 5.0.x is 100% equal the branch 4.0.x so I'm putting the tag "Needs reroll" and marking as "needs works". If this MR is updated just say here and we can merge for us in the sequence
Thank you so much team
Comment #37
Ankit.Gupta commentedReroll the patch #22 with 5.0.x
Comment #38
yashingole commentedI have reviewed and checked Patch #37 this works for drupal 9.5 and drupal 10.0. and 10.0.1
Screenshots of the compatibility on 9.5 and Modal page along with the functionality on 10 have been attached for reference:
Comment #39
renatog commentedBut the Modal is being displayed for you?
I can install on Drupal 10 but I can't see any Modal pop-up in the page
Steps:
Create a node /test
Create a Modal to appear in /test
Result
The Modal isn't being displayed in the page /test
So in other words, any Modal is being displayed in the front-end
Comment #40
renatog commentedError in the console:
Uncaught TypeError: $.removeCookie is not a functionCommenting this line bellow to test the Modal is displayed
Comment #41
renatog commentedI think we need to change from
$.removeCookie('hide_modal_id_' + id_modal);to
cookies.remove('hide_modal_id_' + id_modal);Comment #42
renatog commentedPatch with this fix
Comment #44
renatog commentedMoved to the dev branch
Thank all the team that worked on this. You did an awesome job
Comment #45
renatog commentedNew release Ready for D10. I put all your names there. If I forgot someone I'm sorry just let me know and I can update this.
Thanks a lot team