*/ public function fields(): array { return []; } /** * Whether this integration is available in the current environment. * Override to gate on e.g. WooCommerce being installed. */ public function is_available(): bool { return true; } /** * Wire WP hooks. Only called when the integration is enabled. */ abstract public function boot(): void; /* ===== Settings helpers ===== */ public function is_enabled(): bool { $all = (array) get_option( self::OPTION, [] ); return ! empty( $all[ $this->slug() ]['_enabled'] ); } public function setting( string $key, $default = '' ) { $all = (array) get_option( self::OPTION, [] ); return $all[ $this->slug() ][ $key ] ?? $default; } public function all_settings(): array { $all = (array) get_option( self::OPTION, [] ); return $all[ $this->slug() ] ?? []; } public function update_settings( array $values ): void { $all = (array) get_option( self::OPTION, [] ); $all[ $this->slug() ] = array_merge( $all[ $this->slug() ] ?? [], $values ); update_option( self::OPTION, $all ); } }