githubEdit

Overriding Varbase

First Rule in Overriding

circle-info

Do not change the original code of Drupal Core, Varbase, Vartheme or any other Varbase components. In another words "Do not hack the original code without a trace for the change"

Use the standard Drupal overriding methods.

Custom Tweak Modules

Create custom modules and have your override in them.

Patching Bugs

In case of capturing a bug. Search if it was filed in an issue. Look if the a patch fix for the issue was uploaded.

circle-info

Apply the patch using the Composer patching method using:

cweagans/composer-patchesarrow-up-right

Do not use the manual patching method in projects.

This action will guarantee the direction of keeping track of changes over the code.

Example: In the composer.json file for the project:

Please add the "Issue Number" and the URL for the used patch

Patch for a New Enhancements

An introductory patch for an enhancement over a Varbase component or any Drupal project is welcomed.

A patch may not be committed on the spot. It will need review, and testing for what affect it may do for websites.

circle-info

A patch will work. But although a custom module is the better logic.

Ignoring Patches

Using the cweagans/composer-patchesarrow-up-right composer plugin with patches-ignorearrow-up-right

There may be situations in which you want to ignore a patch supplied by a dependency. For example:

  • You use a different more recent version of a dependency, and now a patch isn't applying.

  • You have a more up to date patch than the dependency, and want to use yours instead of theirs.

  • A dependency's patch adds a feature to a project that you don't need.

  • Your patches conflict with a dependency's patches.

Example:

The Varbase Corearrow-up-right module is requiring Drupal Core with "drupal/core": "~9.0", . Having number of patches to fix issues or overriding Drupal core.

circle-info

Varbase Core's composer.json file for the 9.0.7 version

https://github.com/Vardot/varbase_core/blob/9.0.7/composer.json#L138arrow-up-right

Let imagine that the Drupal core release team had a new release, But they had committed the following issue:

circle-check

The patch fix for the core issue was added when a fix was needed for the following issue:

circle-check

At the point of a new release for Drupal core and in case the patch was committed.

The cweagans/compsoer-patchesarrow-up-right composer plugin will not allow to apply it if it was committed.

Ignore the patch being used as in the following example method:

If you use the URL to the Gitlab MR directly, your code base will change without warning, as people work on the merge request.

https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupal/creating-issue-forks-and-merge-requests#s-patch-files-f[…]se-with-composerarrow-up-right

circle-check
  • Download the .diff or .patch file in a patches folder in the project.

  • Add the module name, issue number, and date for the MR changes to the name of the file.

  • Add the patch local patch to patches.

Example ( NOT Recommended ):

Example ( Recommended remote patch file ):

Example ( Recommended local patch/diff file ):

circle-exclamation
triangle-exclamation
circle-check