Fixed some URLs not getting registered properly.

This commit is contained in:
flash 2024-10-05 15:28:56 +00:00
parent 1f16de2239
commit fc6a899f16

View file

@ -2,16 +2,18 @@
namespace Misuzu; namespace Misuzu;
use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait}; use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Index\Urls\{UrlFormat,UrlRegistry,UrlSource,UrlSourceTrait}; use Index\Urls\{UrlFormat,UrlRegistry,UrlSource};
class LegacyRoutes implements RouteHandler, UrlSource { class LegacyRoutes implements RouteHandler, UrlSource {
use RouteHandlerTrait, UrlSourceTrait; use RouteHandlerTrait;
public function __construct( public function __construct(
private UrlRegistry $urls private UrlRegistry $urls
) {} ) {}
public function registerUrls(UrlRegistry $urls): void { public function registerUrls(UrlRegistry $urls): void {
UrlFormat::register($urls, $this);
// eventually this should be handled by context classes // eventually this should be handled by context classes
$urls->register('search-index', '/search.php'); $urls->register('search-index', '/search.php');
$urls->register('search-query', '/search.php', ['q' => '<query>'], '<section>'); $urls->register('search-query', '/search.php', ['q' => '<query>'], '<section>');