features_controller = $features_controller; } /** * Register the feature surface. * * The feature-flag check is deferred to `on_init` because `feature_is_enabled()` * walks `FeaturesController::init_feature_definitions()`, which contains * `__( ..., 'woocommerce' )` calls. Evaluating those before `init` triggers * WP 6.7's "translation loading … too early" notice (and the headers-already-sent * cascade that follows). * * @since 11.0.0 */ public function register(): void { add_action( 'init', array( $this, 'on_init' ) ); } /** * Wire up the feature surface once translations are safe to load. * * No-op when the gating flag is off. Runtime surfaces are registered here * as they are added in follow-up changes. * * @internal * * @since 11.0.0 */ public function on_init(): void { if ( ! $this->features_controller->feature_is_enabled( self::FEATURE_FLAG ) ) { return; } // Runtime surfaces (staff REST endpoint, attribution hooks, admin Staff UI) // register here as they are added in follow-up changes. } }