| 1 |
<?php |
| 2 |
/** |
| 3 |
* Image-replace module (spec 023-image-replace-module). |
| 4 |
* |
| 5 |
* REST: image search (`GET /templately/v1/ai-content/images`) — relocated from |
| 6 |
* includes/API/AIContent.php's search_images()/register_routes(), a self-contained |
| 7 |
* method with no shared state and no custom permission override (fell through to the |
| 8 |
* base API::_permission_check() default there too). The upload tab additionally uses |
| 9 |
* the standard WordPress Media Library (`wp/v2/media`) REST endpoint via |
| 10 |
* `wp_enqueue_media()`, already called globally for all Templately admin screens by |
| 11 |
* the admin infrastructure (spec 011) — no PHP registration needed for that part. |
| 12 |
* |
| 13 |
* The JS (ImageReplacePanel/ + LightBoxForAiConversation.js — relocated verbatim from |
| 14 |
* react-src/app/components/fsi/sidebar/ImageReplacePanel/ and react-src/app/components/ |
| 15 |
* core/, both had zero consumers outside this feature) has no independent mount point — |
| 16 |
* it's deep-imported directly by its callers (the not-yet-extracted FSI sidebar's |
| 17 |
* AiConversationPanel.tsx, the SDK surface in react-src/sdk/, and the root |
| 18 |
* templately.js bundle for window.TemplatelyImageReplacePanelIsolated), matching spec |
| 19 |
* 019's "no webpack partial" pattern. |
| 20 |
* |
| 21 |
* @package Templately |
| 22 |
*/ |
| 23 |
|
| 24 |
namespace Templately\Modules\ImageReplace; |
| 25 |
|
| 26 |
use Templately\Core\Module_Base; |
| 27 |
use Templately\Modules\ImageReplace\REST\ImageSearch; |
| 28 |
|
| 29 |
class Module extends Module_Base { |
| 30 |
|
| 31 |
public function get_name(): string { |
| 32 |
return 'image-replace'; |
| 33 |
} |
| 34 |
|
| 35 |
public function register_rest_routes(): void { |
| 36 |
ImageSearch::get_instance()->register_routes(); |
| 37 |
} |
| 38 |
} |
| 39 |
|