set( 'admin.upsell', static fn(): Upsell => new Upsell() ); $c->set( 'admin.assets', static fn( Container $c ): Assets => new Assets( $c->get( 'admin.upsell' ), $c->get( 'extra.service' ) ) ); $c->set( 'admin.page', static fn( Container $c ): AdminPage => new AdminPage( $c->get( 'admin.assets' ) ) ); $c->set( 'admin.links', static fn( Container $c ): PluginLinks => new PluginLinks( $c->get( 'admin.upsell' ) ) ); $c->set( 'rest.extras', static fn( Container $c ): RestExtrasController => new RestExtrasController( $c->get( 'repository' ), $c->get( 'schema' ), $c->get( 'extra.service' ) ) ); $c->set( 'rest.settings', static fn( Container $c ): RestSettingsController => new RestSettingsController( $c->get( 'settings' ), $c->get( 'schema' ) ) ); $c->set( 'rest.notices', static fn(): RestNoticesController => new RestNoticesController() ); } /** * {@inheritDoc} * * @param Container $c Container. */ public function boot( Container $c ): void { add_action( 'rest_api_init', static function () use ( $c ): void { $c->get( 'rest.extras' )->register_routes(); $c->get( 'rest.settings' )->register_routes(); $c->get( 'rest.notices' )->register_routes(); /** * Fires after the Lite REST routes are registered. * * @since 1.0.0 * * @param string $namespace REST namespace. */ do_action( 'extrova_register_rest_routes', RestExtrasController::REST_NAMESPACE ); } ); if ( ! is_admin() ) { return; } add_action( 'admin_menu', static fn() => $c->get( 'admin.page' )->register_menu(), 60 ); add_action( 'admin_enqueue_scripts', static fn( $hook_suffix ) => $c->get( 'admin.page' )->enqueue( (string) $hook_suffix ) ); add_filter( 'plugin_action_links_' . EXTROVA_BASENAME, static fn( $links ) => $c->get( 'admin.links' )->links( $links ) ); } }