Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

Difference between custom/Modules and custom/Extension/Modules


I’m trying to understand how customization and overriding of modules exactly work in SuiteCRM8.

More specificity, I don’t understand the difference between the custom/Extension/Modules folder and the custom/Modules foder

What I found in details:

I was trying to add a custom js file onto the Document module with this simple code :

$viewdefs['Documents']['EditView']['templateMeta']['includes'] =
      'file' => 'custom/Extension/modules/Documents/js/editview.js',

At the first place, I added it here :
But with no effect after repair and rebuild

Then, I added the same code at the end of this file :
(not in the Extension folder)

Problem is that this file is rebuild by studio, so I create a new file in the public/legacy/custom/modules/Documents/metadata/ . This one is not removed by Studio.

What is weird is that change in custom/Extention/modulesExt/Vardefs/somefile.php work.

Also, sudio add the exact same code in both folder, but there is one file per fields in the custom/Extention/modules folder, and it’s merged in one file in the custom/modules folder :

files in public/legacy/custom/Extension/modules/Documents/

example code

 // created: 2022-06-03 15:35:30
$dictionary['Document']['fields']['t1_champ1_c']['labelValue']='t1 champ1

files in public/legacy/custom/Extension/modules/Documents/

example code

 // created: 2022-06-03 15:35:30
$dictionary['Document']['fields']['t1_champ1_c']['labelValue']='t1 champ1';

 // created: 2022-06-07 17:25:23

My question precisely :

all of this bring me to this questions :

  • all of this is the normal behavior ?
  • if yes, what is the good practice? when put code in the custom/Extension/modules folder, and when put code direcly in custom/modules folder?

There are several different mechanisms taking place for SuiteCRM customizations.

Here you find listed the ones that work from custom/Extension:

In the vardefs chapters of that guide you find others. And in the metadata chapter. Oh, and languages.

I read again the documentation and effectively is the normal behavior.
But it’s not responding to my question :

Why have we to override vardef in custom/extension/module, metadata in custom/module ? What if I set some vardef in custom/module instead of custom/extension/module?

So, globally, What is the logic behind this?

Who says there is a global logic? :slight_smile:

There might be more than one, for technical reasons, for historical reasons. The software evolves, things change, but there are concerns for backwards-compatibility, so sometimes there is no change to fully reorganize and refactor.

It all boils down to the places in the code gathering up the custom files, and there are several different places.

SuiteCRM/ModuleInstaller.php at master · salesagility/SuiteCRM · GitHub

SuiteCRM/LogicHook.php at master · salesagility/SuiteCRM · GitHub

… and more for language files, themes, etc

All right ! Just wanted to be sure to not miss something and don’t mess my project at the very beginning :stuck_out_tongue:

1 Like