Mirror the reference theme's universal picker on FA5: a generated full catalog of the bundled FA5 Free 5.15.4 fonts (src/Icons/fa5-icons.php, generated from the shipped CSS + SVG fonts), a zibsvg group parsed from the runtime sprite so it cannot drift, and GET /aksrt/v1/icons/catalog. Shared admin pieces: aksrt_icon_markup()/aksrt_sanitize_icon_value() with an SVG allowlist, the picker field/modal assets, and one canonical aksrt-font-awesome handle registered through aksrt_enqueue_fontawesome().
38 lines
785 B
PHP
38 lines
785 B
PHP
<?php
|
|
/**
|
|
* @package AKSRT
|
|
*/
|
|
|
|
namespace AKSRT\Icons;
|
|
|
|
use AKSRT\Admin\ControllerBase;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
/**
|
|
* REST endpoint serving the icon picker catalog.
|
|
*/
|
|
class IconController extends ControllerBase {
|
|
|
|
private static $instance = null;
|
|
|
|
public static function get_instance(): self {
|
|
if (null === self::$instance) self::$instance = new self();
|
|
return self::$instance;
|
|
}
|
|
|
|
public function register_routes(): void {
|
|
register_rest_route(self::API_NAMESPACE, '/icons/catalog', [
|
|
'methods' => 'GET',
|
|
'callback' => [$this, 'get_catalog'],
|
|
'permission_callback' => [$this, 'check_permission'],
|
|
]);
|
|
}
|
|
|
|
public function get_catalog(): \WP_REST_Response {
|
|
return $this->success([
|
|
'groups' => IconCatalog::groups(),
|
|
]);
|
|
}
|
|
}
|