Skip to content

Commit

Permalink
pkp#9434 Updated hook call and fixed handler related bug
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Jun 23, 2024
1 parent acd957c commit 886e84b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions classes/core/PKPRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,10 @@ public function getUserVar($key)
{
// special treatment for APIRouter. APIHandler gets to fetch parameter first
$router = $this->getRouter();

if ($router instanceof \PKP\core\APIRouter && (!is_null($handler = $router->getHandler()))) {
/** @var APIHandler */
$handler = $router->getHandler();
$value = $handler->getParameter($key);
$handler = $router->getHandler(); /** @var \PKP\handler\APIHandler $handler */
$value = $handler->getApiController()->getParameter($key);
if (!is_null($value)) {
return $value;
}
Expand Down
4 changes: 3 additions & 1 deletion classes/handler/APIHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public function __construct(PKPBaseController $controller)
{
parent::__construct();

Hook::call('APIHandler::endpoints', [&$controller, $this]);
$router = $controller->getRequest()->getRouter(); /** @var \PKP\core\APIRouter $router */

Hook::run("APIHandler::endpoints::{$router->getEntity()}", [&$controller, $this]);

$this->apiController = $controller;

Expand Down

0 comments on commit 886e84b

Please sign in to comment.