Extend existing modules
Modules can be extended in order to modify their behaviour in a project without editing the module itself.
View Replacement
The most common extension is the replacement of one of the default views with a custom one. This view will be rendered instead the one, that has been defined in the module. A common use case is to replace the edit view of a user.
// Replace View
Events::addListener(
\NewFrontiers\Framework\Modules\ModuleEvents::MODULE_INIT,
function (ModuleInitEvent $event) {
if ($event->getModule()->name == 'User') {
$event->getModule()->addReplacement(
NewFrontiers\Modules\User\Views\EditUser::class,
Osiris\Users\Views\EditUser::class
);
}
}
);