Automated Drupal 10 compatibility fixes

Created on 15 June 2022, over 2 years ago
Updated 25 February 2023, over 1 year ago

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

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

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, Needs work or Reviewed and tested by the community) 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.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  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 then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). 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, Needs work and Reviewed and tested by the community) 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 would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

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 Project analysis issue queue .

📌 Task
Status

Fixed

Version

2.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States wells Seattle, WA

    Due to the nature of the CKEditor plugins there won't be support for D10 in the 8.x-2.x branch.

  • 🇺🇸United States justcaldwell Austin, Texas

    Will you elaborate on this decision?

    If the Update Bot is correct, the changes needed to support D10 in the 2.x branch are minimal, and CKEditor 4 will continue to be available in D10 as a contrib project .

  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States wells Seattle, WA

    Oops! I didn't think about the contrib project. Yes, we should support that and I assume will require more changes that just what Update Bot has given us here?

  • 🇺🇸United States justcaldwell Austin, Texas

    That's great news! I'll do some testing to try to sort out what's needed. Thanks.

  • @justcaldwell opened merge request.
  • @justcaldwell opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇺🇸United States justcaldwell Austin, Texas

    MR3 is pretty minimal. It applies the update bot patch (#3), allows composer/installers 1.0 or 2.0, and adds the drupal 10 core version requirement.

    With those changes, I was able to manually test on a clean Drupal 10.0.3 instance, and everything works as expected. I'm not set up to run automated tests on D10 at the moment, and I seems like the tests above will only run against MR2, which I closed because I accidentally targeted the 3.x branch. Perhaps someone else could confirm the tests pass, or can figure out how to get the automated tests to use MR3? 🙏

    Steps I used to install and test:

    1. Install CKEditor 4 - 1.0.1 contrib project (CKE4 for D10), and enable it on at least one text format/editor
    2. Install the mglaman/composer-drupal-lenient if it's not already in your project.
    3. Add ckeditor_codemirror to the lenient allowed-list composer config --merge --json extra.drupal-lenient.allowed-list '["drupal/ckeditor_codemirror"]'
    4. composer require 'drupal/ckeditor_codemirror:2.x-dev@dev'
    5. Apply the MR3 patch
    6. Install w8tcha/CKEditor-CodeMirror-Plugin manually or as described on the project page.
    7. Enable ckeditor_codemirror module and configure it for the text editor in step 1 above.
  • 🇺🇸United States wells Seattle, WA

    Thanks, @justcaldwell. This is looking the good.

    The only part I remain unclear on is, do we need to make changes to ckeditor_codemirror.info.yml#L7 in support of the switch to contrib ckeditor? How does this work for supporting both pre-10 core version and post-10 contrib version?

  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States justcaldwell Austin, Texas

    That's an excellent point! After digging a bit, it looks like there's some potential issues around this (see 🐛 Incorrect version of CKEditor being parsed from info.yml files Active and 🐛 The contrib ckeditor project is installed unexpectedly Closed: duplicate ).

    I can tell you that I tested on Drupal 9.5, and it "just works" — that is, this issue branch works just fine in 9.5 regardless of which version of ckeditor 4 is installed, core or contrib. (In this case, I cloned the repo into the project, so I can't yet speak to what Composer might do.)

    I assume this is the case because a contrib module is essentially able to stand in for a core module dependency, based on this comment from Wim Leers 🐛 The contrib ckeditor project is installed unexpectedly Closed: duplicate :

    Drupal core specifically is designed to let a module named identically to a core module to completely override the core module.

    At a minimum, since contrib ckeditor 4 is only works with Drupal 9.4+, the core version requirement would need to change to ^9.4 || ^10.

    I guess another other option would be to release a separate D10 branch with an explicit dependency on contrib ckeditor:ckeditor?

    So, definitely some additional thinking is required here. To be honest, I'm thinking about dropping ckeditor_codemirror from our project until we can migrate to ckeditor5.

  • 🇺🇸United States wells Seattle, WA

    Yeah this is the headache I was worried about (:

    I wonder if this has been asked about the in the Drupal Slack #ckeditor5 channel? If not we could ask about it there.

    I would be fine with changing the core version requirement to ^9.4 || ^10 so it's just a matter of figuring out how to address the dependency...

    Do non-namespaced dependencies still work? I wonder if we could just set it ckeditor and that would work in both 9 and 10...

  • 🇺🇸United States justcaldwell Austin, Texas

    Agreed — it's a bit of a pain.

    I'm not sure whether dropping the namespace still works, but the drupal:ckeditor dependency worked fine in both 9 and 10 in my testing. Surprising, but I guess the contrib module is able substitute even in D10.

    For me, the primary unknown is if composer will get tripped up in a D9 project, since I didn't explicitly test a composer install on D9 (worked fine on D10). Some of the issues I reviewed mention people having composer-related problems. I'll try to carve out some time to test that this week.

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States justcaldwell Austin, Texas

    I updated the MR with the ^9.4 || ^10 core version requirement, and installed with composer on both D9 and D10. It went great. I think the composer problems I'd seen in other issues were due to those modules having a hard dependencies on ckeditor in their own composer.json files.

    On Drupal 9, the issue branch installed with composer (using this method ) and worked equally well with either core or contrib ckeditor.

    On Drupal 10, when I installed drupal/ckeditor_codemirror:^2.4 with composer (again, using the lenient plugin), it actually also installed drupal/ckeditor (contrib ckeditor 4) even though I didn't explicitly require it, nor is it required in the module composer.json file. So, it would seem that packages.drupal.org sees the drupal:ckeditor dependency in the info file and provides the contrib version to satisfy that—even though the namespaced depedency for the contib module would be ckeditor:ckeditor. Nice!

    A good next step might be to tag a pre-release (e.g. 8.x-2.5-beta1). That would allow for others to install and test without all the composer workarounds.

  • 🇺🇸United States wells Seattle, WA

    A good next step might be to tag a pre-release (e.g. 8.x-2.5-beta1). That would allow for others to install and test without all the composer workarounds.

    Makes sense! Lets give it a go...

  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States wells Seattle, WA

    Alright 8.x-2.5-beta1 is ready for testing!

  • 🇺🇸United States justcaldwell Austin, Texas

    Thanks @wells! Just a couple of quick follow-ups:

    1) Now that I'm able to use the standard install method, composer downloads the contrib version of ckeditor when installing on Drupal 9. Seems to just be a fact of life for the Drupal ckeditor 4 ecosystem 🐛 Incorrect version of CKEditor being parsed from info.yml files Active for now and everything still works. There's a simple workaround for anyone who wants to avoid this—I'll open a separate issue to document that.

    2) I think tests are going to fail in D10 since the 'stable' theme is no longer available. That just needs to be changed to 'stark'.

  • 🇺🇸United States justcaldwell Austin, Texas
  • 🇺🇸United States wells Seattle, WA

    1) Now that I'm able to use the standard install method, composer downloads the contrib version of ckeditor when installing on Drupal 9. Seems to just be a fact of life for the Drupal ckeditor 4 ecosystem for now and everything still works. There's a simple workaround for anyone who wants to avoid this—I'll open a separate issue to document that.

    It's interesting to me this is seen a problem... I figured this was a good/expected thing, hah. But yeah will add a release note with 📌 The contrib ckeditor project is installed unexpectedly Active .

    2) I think tests are going to fail in D10 since the 'stable' theme is no longer available. That just needs to be changed to 'stark'.

    I was thinking we would just rely on the 3.0.x branch for D10 but yeah I suppose some folks will want to update to D10 and keep ckeditor4 around with the 8.x-2.x branch. I almost don't want to support that but it is understandable.

  • 🇺🇸United States justcaldwell Austin, Texas

    I suppose some folks will want to update to D10 and keep ckeditor4 around with the 8.x-2.x branch

    It's a temporary measure for us. We have a custom ckeditor4 plugin that still needs to be ported to ckeditor5. We'd like to get to Drupal 10 while that happens.

  • 🇺🇸United States wells Seattle, WA

    Alright we've got green tests on D9 and D10 now. Lookin' good...

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

Production build 0.71.5 2024