plugin = $plugin; } /** * Hooks route registration. */ public function register(): void { add_action( 'rest_api_init', array( $this, 'register_routes' ) ); } /** * Registers all routes, then lets add-ons add theirs. */ public function register_routes(): void { $controllers = array( new SettingsController( $this->plugin ), new AuthController( $this->plugin ), new AdminController( $this->plugin ), new ReportsController( $this->plugin ), new PostsController( $this->plugin ), new SystemController( $this->plugin ), new ClarityController( $this->plugin ), ); foreach ( $controllers as $controller ) { $controller->register_routes(); } /** * Fires after the tagsmith/v1 routes are registered, on rest_api_init. * Add-ons register their own routes here. * * @since 2.0.0 * * @param Plugin $plugin The plugin service locator. */ do_action( 'tagsmith_rest_init', $this->plugin ); } }