Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,090 of 9,090 pages
About the help in other languages
All help pages

Extending without forking

Change how the kernel or someone else's extension behaves from your own extension - settings, template overrides, design order, handlers, events, module replacement - so their updates keep reaching you.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-5-extend-fork-contribute/extending-without-forking.md

On this page

Extending without forking

Part 5, chapter 1. Before you copy someone else's extension and change it, look for a way to change its behavior from your own extension. Exponential was built for this: almost everything the kernel and well-written extensions do can be adjusted from outside. This chapter lists the ways, from the lightest to the heaviest, so you can pick the lightest one that works.

Why it matters

When you change someone else's files, you own those changes forever. Every update of the original has to be merged with your changes by hand. When you change behavior from your own extension, the original stays untouched: you update it with composer update, and your extension keeps doing its job.

The ways, from light to heavy

WayWhat it changesChapter
1. A setting in your extension's settings/*.ini.append.phpanything the original reads from its INI fileSettings in an extension
2. A template in your designhow a page or a part looksThe design chain
3. A template override rule (override.ini)one template for one class, node, section or view modeTemplate overrides
4. A template operator or fetch function of your ownwhat templates can compute or loadTemplate operators
5. An event listener or filterwhat happens before or after kernel actionsEvents, listeners and filters
6. A handler named by a settinga whole service (mail transport, image handler, search)Handlers named by settings
7. A subclass of the original class, registered where the original is namedone class's behaviorbelow
8. A module of the same name in your extensiona whole module and its viewsExtension module override
9. A kernel overridea kernel classKernel overrides: the last resort

Each step down the list ties you closer to the original's internals, so an update of the original is more likely to need a change on your side.

Who wins: the load order

Most of these ways work because the kernel reads the active extensions in an order, and the last setting or the first template found wins. Your extension must therefore load in the right place relative to the one it changes. Name the original in your extension.xml:

<dependencies>
    <requires>
        <extension name="theoriginal" />
    </requires>
</dependencies>

The details, including how to check the order you got, are in Extension load order.

Example: a different template for one block

The original extension renders a block with design/standard/templates/theoriginal/block.tpl. You want another markup. In your extension:

extension/mysite/design/mysite/templates/theoriginal/block.tpl

with your design (mysite) placed before standard in the siteaccess's design list. The original's file stays as it is; yours is found first. If you only need it for one content class, use an override rule instead, so the original's template still serves the others.

Example: one setting changed

The original reads theoriginal.ini [ListSettings] Limit=10. In your extension:

<?php /* #?ini charset="utf-8"?

[ListSettings]
Limit=25

*/ ?>

saved as extension/mysite/settings/theoriginal.ini.append.php. With your extension after the original in the load order, Limit is 25.

Example: a subclass

When the original names its classes in settings (many do: handlers, block types, converters), register a subclass of your own there:

<?php
class mySiteListHandler extends theOriginalListHandler
{
    public function title()
    {
        return 'Latest from ' . parent::title();
    }
}

Override only the methods you need and call parent:: for the rest. Regenerate the autoloads after adding the class (php bin/php/ezpgenerateautoloads.php -e). If the original creates the class with new directly and names it nowhere, a subclass cannot replace it, and you have found a good reason to ask the author for a setting (Writing good issues).

When none of this works

Then you need to change the original's code. There are still two ways that do not mean a fork:

  1. Ask for an extension point. Open an issue that explains what you want to change and proposes a setting, an event or a template variable. Better: send it as a pull request (Contributing back with pull requests). Once it is merged, you extend without forking.
  2. Wait for it in a branch of your fork while the pull request is open, and go back to the original once it is released (When to fork, and when not to).

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x