| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template-browsing module (spec 017-template-browsing). |
| 4 |
* |
| 5 |
* The template library discovery surface: items listing/search/counts/featured/ |
| 6 |
* trending plus the public metadata endpoints (categories, tags, template types). |
| 7 |
* Relocated from includes/API/ — behavior byte-identical (same routes, params, |
| 8 |
* transient cache keys). The Dependencies endpoint stays with 020-single-import |
| 9 |
* per the PRD ownership ruling. |
| 10 |
* |
| 11 |
* @package Templately |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace Templately\Modules\TemplateBrowsing; |
| 15 |
|
| 16 |
use Templately\Core\Module_Base; |
| 17 |
use Templately\Modules\TemplateBrowsing\REST\Categories; |
| 18 |
use Templately\Modules\TemplateBrowsing\REST\Items; |
| 19 |
use Templately\Modules\TemplateBrowsing\REST\Tags; |
| 20 |
use Templately\Modules\TemplateBrowsing\REST\TemplateTypes; |
| 21 |
|
| 22 |
class Module extends Module_Base { |
| 23 |
|
| 24 |
public function get_name(): string { |
| 25 |
return 'template-browsing'; |
| 26 |
} |
| 27 |
|
| 28 |
public function get_dependencies(): array { |
| 29 |
// items/favourite + items/rating delegate to the shared permission chain that |
| 30 |
// auth's session state feeds; auth must be booted first (spec 017 contract). |
| 31 |
return [ 'auth' ]; |
| 32 |
} |
| 33 |
|
| 34 |
public function register_rest_routes(): void { |
| 35 |
Items::get_instance()->register_routes(); |
| 36 |
Categories::get_instance()->register_routes(); |
| 37 |
Tags::get_instance()->register_routes(); |
| 38 |
TemplateTypes::get_instance()->register_routes(); |
| 39 |
} |
| 40 |
} |
| 41 |
|