diff --git a/includes/RestApi/RestApi.php b/includes/RestApi/RestApi.php index 2b1c620e7..8c2fba99b 100644 --- a/includes/RestApi/RestApi.php +++ b/includes/RestApi/RestApi.php @@ -28,6 +28,7 @@ final class RestApi { 'NewfoldLabs\WP\\Module\\Onboarding\\RestApi\\Themes\\ThemeInstallerController', 'NewfoldLabs\WP\\Module\\Onboarding\\RestApi\\Themes\\ThemeFontsController', 'NewfoldLabs\WP\\Module\\Onboarding\\RestApi\\Themes\\ThemeColorsController', + 'NewfoldLabs\\WP\\Module\\Onboarding\\RestApi\\SiteClassificationController', ); /** diff --git a/includes/RestApi/SiteClassificationController.php b/includes/RestApi/SiteClassificationController.php new file mode 100644 index 000000000..863e764b3 --- /dev/null +++ b/includes/RestApi/SiteClassificationController.php @@ -0,0 +1,56 @@ +namespace, + $this->rest_base, + array( + 'methods' => \WP_REST_Server::READABLE, + 'callback' => array( $this, 'get' ), + 'permission_callback' => array( Permissions::class, 'rest_is_authorized_admin' ), + ) + ); + } + + /** + * Get site classification data. + * + * @return array + */ + public function get() { + if ( ! class_exists( 'NewfoldLabs\WP\Module\Data\SiteClassification' ) ) { + return array(); + } + $classification = new SiteClassification(); + return $classification->get(); + } +}