The Extension Mechanism: Details and Best Practices

Last updated 9 days ago

This guide explains some best practices for project extensions

LightbulbWhat you'll learn

  • Use project extensions effectively

Person reading a bookPrerequisites

  • Know extensions

WristwatchTime matters

Reading time: 5 minutes

Person in front of a laptopShould I read this?

This guide is for Developers.

To get started developing extensions to CoreMedia software, first see the documentation here:

How do I organise my project extensions?

There are as many solutions to this as there are projects. However, the method sketched below is a clean, general solution which has many advantages.

For each extension "my-extension" create a module under /modules/extensions. For each component, create a submodule e.g. "my-extension-cae" in this module.

This solution is also extensible for other components (for example, my-extension-importer). You only need to put an importer-extension-dependencies module into the extensions-config and use it as dependency of the importer. Your "my-extension-importer" modules should then just contain the variable importer.

I just have a small customization. Isn’t the extension mechanism a bit of overkill?

Even if it looks a bit "oversized" on the first glance, the benefits come when upgrading to a new CoreMedia version. Organising your extensions as above means that the project customizations are clearly separated from the Blueprint product code. So merging new CM versions with existing project code should be very simple.

What should I do with custom modules that do not directly extend any CoreMedia component?

The CoreMedia modules and your own custom modules should be separated as much as possible, in order to make later updates easier. Because of this, we suggest that you put your modules in a folder directly below "modules", e.g. /modules/custom-extensions. In this folder you can create further subfolders for different components such as /modules/custom-extensions/cae and /modules/custom-extensions/search.

There is no extension point for component x. How do I create an extension for that component?

If there is no extension point built-in specifically, you can create one. Add the extension point under modules/extension-config similar to the other extension points already available there. Then, add the dependency to the newly created extension point to your component x directly.

Copyright © 2024 CoreMedia GmbH, CoreMedia Corporation. All Rights Reserved.
Loading...