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:

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

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

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

  1. Apply the patch in the comment by Project Update Bot.
  2. 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”.

Issue fork modal_page-3288686

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

Project Update Bot created an issue. See original summary.

project update bot’s picture

Status: Active » Needs review
StatusFileSize
new775 bytes

This 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.yml file 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

Bot run #127

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.9
  2. palantirnet/drupal-rector: 0.12.0
project update bot’s picture

This 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.yml file 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

Bot run #139

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.24
  2. palantirnet/drupal-rector: 0.13.0
vitorbs’s picture

Assigned: Unassigned » vitorbs
Issue summary: View changes
Issue tags: -ProjectUpdateBotD10

I will try to work on that.

vitorbs’s picture

Assigned: vitorbs » Unassigned
StatusFileSize
new2.49 KB

I reviewed and applied the remaining necessary changes, so now just need to review it again.

vitorbs’s picture

StatusFileSize
new3.67 KB
paulocs’s picture

Status: Needs review » Needs work

I have done a review and there are some changes in the patch that have to be made:

1) In modal_page/src/Form/ModalForm.php should 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 the core_version_requirement: ^8.8 || ^9 || ^10 should be actually core_version_requirement: ^9.3 || ^10.

3) In modal_page.install file, non static method 'getPath' should not be called statically. It should be changed to \Drupal::service('extension.list.module')->getPath('modal_page')

vitorbs’s picture

Assigned: Unassigned » vitorbs
vitorbs’s picture

StatusFileSize
new4.95 KB
vitorbs’s picture

Assigned: vitorbs » Unassigned
Status: Needs work » Needs review
renatog’s picture

lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

Assigned: lucassc » Unassigned
StatusFileSize
new4.92 KB
new444 bytes

Hi, 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:

FILE: ...ontrib/try-drupal-10/web/modules/contrib/modal_page/src/Form/ModalForm.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 49 | ERROR | [x] Function comment short description must start with exactly
    |       |     one space
 50 | ERROR | [x] Whitespace found at end of line
 52 | ERROR | [ ] Missing @var tag in member variable comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 150ms; Memory: 16MB

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?

paulocs’s picture

Status: Needs review » Needs work

1) Unused use statement use Drupal\Core\Extension\ExtensionPathResolver; in modal_page.install

reenaraghavan’s picture

Assigned: Unassigned » reenaraghavan

reenaraghavan’s picture

Assigned: reenaraghavan » Unassigned
StatusFileSize
new81.51 KB
new81.51 KB

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

reenaraghavan’s picture

StatusFileSize
new71.58 KB
reenaraghavan’s picture

vitorbs’s picture

Assigned: Unassigned » vitorbs
paulocs’s picture

Please 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

vitorbs’s picture

StatusFileSize
new4.57 KB

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

vitorbs’s picture

Assigned: vitorbs » Unassigned
Status: Needs work » Needs review
vitorbs’s picture

StatusFileSize
new19.4 KB
reenaraghavan’s picture

@paulocs, @vitorbsI am new to contributions, and sorry if I have done anything wrong.

paulocs’s picture

You 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 :)

paulocs’s picture

vitorbs’s picture

ok, i will work on the MR, thanks!

vitorbs’s picture

Assigned: Unassigned » vitorbs
Status: Needs review » Needs work
vitorbs’s picture

I fixed the STATUS_PERMANENT deprecated functions that @reenaraghavan found on her scan.

vitorbs’s picture

Assigned: vitorbs » Unassigned
Status: Needs work » Needs review
gquisini’s picture

Assigned: Unassigned » gquisini

I'll be reviewing this issue.

gquisini’s picture

StatusFileSize
new183.8 KB
new34.12 KB

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

gquisini’s picture

Assigned: gquisini » Unassigned
Status: Needs review » Reviewed & tested by the community
renatog’s picture

Version: 4.1.x-dev » 5.0.x-dev

Thank 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

renatog’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

I 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.js

Now 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

Ankit.Gupta’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new9.06 KB

Reroll the patch #22 with 5.0.x

yashingole’s picture

I 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:

renatog’s picture

Status: Needs review » Needs work

But 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

  1. Add a new page at node/add/page
  2. Put any title and any body
  3. On alias of this node put /test
  4. Save

Create a Modal to appear in /test

  1. Install at Drupal 10
  2. Go to admin/structure/modal/add
  3. Fill any title and any body
  4. On pages put /test
  5. Save

Result

The Modal isn't being displayed in the page /test

So in other words, any Modal is being displayed in the front-end

renatog’s picture

Error in the console:

Uncaught TypeError: $.removeCookie is not a function

Commenting this line bellow to test the Modal is displayed

// Remove the cookie if show only once option is disabled.
if (show_once != "1") {
  $.removeCookie('hide_modal_id_' + id_modal);
}
renatog’s picture

I think we need to change from
$.removeCookie('hide_modal_id_' + id_modal);
to
cookies.remove('hide_modal_id_' + id_modal);

renatog’s picture

Status: Needs work » Needs review
StatusFileSize
new7.49 KB

Patch with this fix

  • 6a72739 committed on 5.0.x
    Issue #3288686 by vitorbs, reenaraghavan, Project Update Bot, lucassc,...
renatog’s picture

Status: Needs review » Fixed

Moved to the dev branch

Thank all the team that worked on this. You did an awesome job

renatog’s picture

New 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

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.