add_render_attribute( $this->element_attribute_ids['nav'], [ 'class' => $pagination_class, ] ); } private function add_render_attibutes() { $id = $this->get_id(); $settings = $this->get_settings_for_display(); $screen_only_class = 'elementor-screen-only'; $this->add_render_attribute( $this->element_attribute_ids['search_wrapper'], [ 'class' => [ 'e-search', 'hidden' ], 'role' => 'search', ] ); if ( 'previous_next' === $settings['pagination_type_options'] ) { $this->add_render_attribute( $this->element_attribute_ids['results_wrapper'], [ 'class' => 'hide-pagination-numbers', ] ); } $this->add_render_attribute( $this->element_attribute_ids['form'], [ 'class' => 'e-search-form', 'action' => esc_url( home_url() ), 'method' => 'get', ] ); $this->add_render_attribute( $this->element_attribute_ids['label'], [ 'class' => 'e-search-label', 'for' => "search-$id", ] ); $this->add_render_attribute( $this->element_attribute_ids['label_text'], [ 'class' => $screen_only_class, ] ); $this->add_render_attribute( $this->element_attribute_ids['input_wrapper'], [ 'class' => 'e-search-input-wrapper', ] ); $this->add_render_attribute( $this->element_attribute_ids['input'], [ 'id' => "search-$id", 'placeholder' => esc_attr( $settings['search_input_placeholder_text'] ), 'class' => 'e-search-input', 'type' => 'search', 'name' => 's', 'value' => '', 'autocomplete' => $this->get_autocomplete_state(), 'role' => 'combobox', 'aria-autocomplete' => 'list', 'aria-expanded' => 'false', 'aria-controls' => "results-$id", 'aria-haspopup' => 'listbox', ] ); $this->add_render_attribute( $this->element_attribute_ids['submit_button'], [ 'class' => [ 'e-search-submit', $this->is_submit_button_shown() ? '' : $screen_only_class, $settings['submit_hover_animation'] ? 'elementor-animation-' . $settings['submit_hover_animation'] : '', ], 'type' => 'submit', ] ); if ( empty( $settings['submit_button_text'] ) ) { $this->add_render_attribute( $this->element_attribute_ids['submit_button'], 'aria-label', esc_html__( 'Search', 'elementor-pro' ) ); } $this->add_render_attribute( $this->element_attribute_ids['submit_text'], [ 'class' => $this->is_submit_button_shown() ? '' : $screen_only_class, ] ); $this->add_render_attribute( $this->element_attribute_ids['results_wrapper'], [ 'id' => "results-$id", 'class' => 'e-search-results-container hide-loader', 'aria-live' => 'polite', 'aria-atomic' => 'true', 'aria-label' => esc_attr__( 'Results for search', 'elementor-pro' ), 'tabindex' => '0', ] ); $this->add_render_attribute( $this->element_attribute_ids['widget_props'], [ 'type' => 'hidden', 'name' => 'e_search_props', 'value' => $this->get_id() . '-' . Pro_Utils::get_current_post_id(), ] ); } private function is_submit_button_shown() { return 'key_enter' !== $this->get_settings_for_display( 'submit_trigger' ); } private function get_autocomplete_state() { return 'yes' !== $this->get_settings_for_display( 'autocomplete' ) ? 'off' : 'on'; } private function get_dropdown_width() { return 'widget_width' === $this->get_settings_for_display( 'results_is_dropdown_width' ); } private function maybe_render_icon( $target ) { $icon_settings = $this->get_settings_for_display( $target ) ?? [ 'library' => '', 'value' => '', ]; Icons_Manager::render_icon( $icon_settings ?? [ '', '' ], [ 'aria-hidden' => 'true' ], 'i' ); } private function get_supported_post_types() { $supported_post_types = [ 'any' => esc_html__( 'All', 'elementor-pro' ), 'product' => esc_html__( 'Products', 'elementor-pro' ), 'post' => esc_html__( 'Posts', 'elementor-pro' ), 'page' => esc_html__( 'Pages', 'elementor-pro' ), ]; $cpts = $this->get_supported_cpts(); return array_merge( $supported_post_types, $cpts ); } private function get_supported_cpts() { $cpts = new Collection( get_post_types( [ 'public' => true, '_builtin' => false, ], 'objects' ) ); return $cpts->except( [ 'product', 'related_products', 'elementor_library' ] ) ->map_with_keys( function ( $item, $post_type ) { return [ $post_type => $item->label ?? null ]; } ) ->filter() ->all(); } private function get_property_key_prefix() { return $this->get_query_name() . '_query'; } }