__( 'An AI assistant chat window or a button that opens it.', 'agentixhub-chat' ), 'customize_selective_refresh' => true, ) ); } public static function register(): void { register_widget( __CLASS__ ); } public function widget( $args, $instance ) { $instance = wp_parse_args( (array) $instance, $this->defaults() ); $html = Agentix_Chat_Frontend::render_embed( $instance ); if ( '' === $html ) { return; } echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput -- theme markup if ( $instance['title'] ) { echo $args['before_title'] . esc_html( apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput } echo $html; // phpcs:ignore WordPress.Security.EscapeOutput -- escaped in render_embed echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput } public function form( $instance ) { $i = wp_parse_args( (array) $instance, $this->defaults() ); ?>

sanitize_text_field( $new['title'] ?? '' ), 'mode' => ( $new['mode'] ?? '' ) === 'button' ? 'button' : 'inline', 'height' => max( 300, min( 1200, (int) ( $new['height'] ?? 520 ) ) ), 'label' => sanitize_text_field( $new['label'] ?? '' ), ); } private function defaults(): array { return array( 'title' => '', 'mode' => 'inline', 'height' => 520, 'label' => '' ); } }