Patch a Drupal project
Patches can be provided by or to the community to deliver a fix or a new feature to a Drupal project. The scope can be a core or contributed project patch.
On a Drupal.org issue, there are 2 ways to get a patch
- Via a patch file, attached to the issue
- Via a git branch / Merge request on GitLab
On the first case, you can just reference the patch file, locally or on Drupal.org via an absolute url.
For the second case, you should always download it as the Merge Request might evolve, so the codebase change is not set in stone. To download it locally, just append the .patch extension to the Merge Request url.
For this issue (opens in a new tab) we have
- A patch file in the first comments, to demonstrate a POC, it could be referenced straight in your composer.json section https://www.drupal.org/files/issues/2023-03-12/3086883-13.patch (opens in a new tab).
- A Merge request, you can download the patch from this URL https://git.drupalcode.org/project/drupal/-/merge_requests/3642.patch (opens in a new tab)