-
Notifications
You must be signed in to change notification settings - Fork 0
Extensions
Eric Lamb edited this page Feb 7, 2022
·
7 revisions
Just like with Module and Control Panel routing, you have to extend your ExpressionEngine Addon file to use the cooresponding EE Objects Controller Base route. In this case, that'll be EeObjects\Controllers\Extension.
You'll also have to add a new property to your Extension called $route_namespace which is the namespace for route objects.
use EeObjects\Controllers\Extension;
class Your_addon_ext extends Extension
{
protected $route_namespace = 'Namespace\For\Your\Controllers';
}Note that $route_namespace isn't directly one to one. EE Objects Controller does some magic to keep things compartmentalized. Using the below example, the namespace used to locate your Route objects would be Namespace\For\Your\Controllers\Extensions\Routes.
Note that your process method's signature should match up with the ExpressionEngine hooks passed parameters.
namespace EeObjects\Addon\Controllers\Extension\Routes;
use EeObjects\Controllers\Extension\AbstractRoute;
class TemplatePostParse extends AbstractRoute
{
public function process(string $final_template, bool $is_partial, $site_id, array $currentTemplateInfo): string
{
return $final_template;
}
}