Automated Drupal 10 compatibility fixes

Created on 18 July 2022, over 2 years ago
Updated 23 May 2024, 7 months 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 β†’

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

πŸ“Œ Task
Status

Fixed

Version

2.1

Component

Code

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • πŸ‡¬πŸ‡§United Kingdom bmango

    With this patch this module is working on D10 for me.

  • Status changed to RTBC over 1 year ago
  • Verified the #2 patch on 9.5.8, and 10.0.0 for drupal 10 compatibilty. Added screenshots for reference, RTBC++

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States hockey2112

    Is there a planned Drupal 10 release date? I am trying to finish upgrading my D9 site to D10, and this module is holding it back. This is the message I am receiving from composer:

    drupal/bg_img_field 1.7.0 requires drupal/core ^8 || ^9 -> satisfiable by drupal/core[8.0.0-beta6, ..., 8.9.20, 9.0.0-alpha1, ..., 9.5.10].
    

    I applied the patch in this thread, and I am still receiving that message.

  • πŸ‡¬πŸ‡§United Kingdom bmango

    @hockey2112, you can always remove the module from your composer.json file then download the module manually and then apply the patch. Once the module has a release that is compatible with Drupal 10 then you can delete the module manually, and add it back into your composer.json file.

  • πŸ‡ΊπŸ‡ΈUnited States hockey2112

    I ended up going a different route:

    1. I already had Background Image Formatter installed. So I created a new image field using that module as a formatter.
    2. Then I installed filefield_paths and changed the file structure URL dir for the old background image field to "backgroundold". For new new field, I made the dir "backgroundnew".
    3. I exported the old background image field's DB table as CSV, removed the columns that don't exist for the newly-created image field that I am using as the new background image field, and then imported that CSV into the image field's db table.
    4. Then, I used a SQL statement on the file_managed table to change the dir for the existing background image files:
      UPDATE file_managed
      SET uri = REPLACE(uri, 'backgroundold', 'backgroundnew')
      WHERE uri LIKE '%backgroundold%';
    5. Lastly, I deleted the old background image field and cleared cache, and then uninstalled and composer remove the bg_img_field module.

    Might have been overkill, but it worked and it simplified and enhanced my setup as follows:

    1. I can now set an ALT on the image used for the background.
    2. I can now use IMCE to choose the image since this is just an image field. This will allow me to avoid uploading multiple copies of the same large background images.
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States NicholasS

    For others who can't patch, here is how to switch to using the Forks Issue Branch.

    Modify your composer.json as follows.
    1. in your "repositories" : [ ] add the following into that array.

    {
                "type": "composer",
                "url": "https://packages.drupal.org/8",
                "exclude": [
                    "drupal/bg_img_field"
                ]
            },
            {
                "type": "vcs",
                "url": "https://git.drupalcode.org/issue/bg_img_field-3296632.git"
            },
    

    Then run composer require "drupal/bg_img_field:dev-8.x-1.x" --prefer-dist to switch to using the forks branch.

    When this is merged you just have to remove those, and then composer require the official one again.

  • πŸ‡ΊπŸ‡ΈUnited States hockey2112

    @bmango, I had to do another Drupal 9 > 10 upgrade today, and this module was once again causing issues. I followed your advice, and it worked like a charm. Here were my steps:

    1. I moved the bg_img_field dir to the root dir, outside of the Drupal installation.
    2. I removed the bg_img_field line from composer.json.
    3. I ran composer update to upgrade to D10.
    4. I then created a new dir at public_html/modules/manual and added the bg_img_field dir there.
    5. I then ran update.php, and everything seems to be working great.

    Thanks for your idea!

  • Merge request !48.x 2.0 β†’ (Merged) created by JFortune
  • Status changed to Fixed 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States JFortune
  • Status changed to Fixed 7 months ago
  • πŸ‡ΊπŸ‡ΈUnited States JFortune
Production build 0.71.5 2024