diff --git a/SeacmsApi.php b/SeacmsApi.php index 547e440..37ca0ac 100644 --- a/SeacmsApi.php +++ b/SeacmsApi.php @@ -2,6 +2,7 @@ // SPDX-License-Identifier: EUPL-1.2 // Authors: see README.md +use SeaCMS\Api\ApiAware; use SeaCMS\Api\BadMethodException; use SeaCMS\Api\JsonResponse; use SeaCMS\Api\NotFoundRouteException; @@ -9,7 +10,7 @@ use SeaCMS\Api\NotFoundRouteException; /** * An api plugin for Pico 3. */ -class SeacmsApi extends AbstractPicoPlugin +class SeacmsApi extends AbstractPicoPlugin implements ApiAware { /** * Pico API version. @@ -67,7 +68,7 @@ class SeacmsApi extends AbstractPicoPlugin { $this->routesOnPageRendered = []; foreach($plugins as $plugin){ - if (method_exists($plugin,'registerOnPageRenderedApiRoutes')){ + if ($plugin instanceof ApiAware){ $routes = $plugin->registerOnPageRenderedApiRoutes(); if (is_array($routes)){ foreach($routes as $route => $methodName){ diff --git a/src/ApiAware.php b/src/ApiAware.php new file mode 100644 index 0000000..3662032 --- /dev/null +++ b/src/ApiAware.php @@ -0,0 +1,17 @@ +