I will say right away that this is a very, very bad idea. Making changes to the drupal core is necessary only when there is no other way to solve the problem. Any drupal update can break all your edits.
- Create a repository in the core git folder
cd /path/to/drupal/core git init git add . git commit -am 'Initial commit'
- Make changes to the core files.
- Create a patch in the patches folder:
mkdir /path/to/drupal/patches cd /path/to/drupal/core git diff > /path/to/drupal/patches/my-drupal-core-hacks.patch
It is important that the patches folder is located next to the main composer.json
- Install the cweagans/composer-patches package:
cd /path/to/drupal composer require cweagans/composer-patches
We add information about the patch to the main composer.json:
{ ... "extra": { "patches": { "drupal/core": { "My drupal core hacks": "patches/my-drupal-core-hacks.patch" } } } }
6.Remove the git repository from core:
rm -rf /path/to/drupal/core/.git
A patch will now be applied automatically when updating the drupal core. Similarly, you can make changes to other modules in this way.
Similar Posts:
- install drupal 8 with composer
- Install Drupal 8 via composer
- composer require fails because it can’t delete default.services.yml
- How to apply Drupal Patch
- How to remove a package from Laravel using composer
607