get_settings_for_display(); $el_id = $this->get_id(); $behavior = []; $behavior[] = [ 'behaviorClass' => 'LiquidToggleBehavior', 'options' => [ 'changePropPrefix' => "'lqdSearchToggle-$el_id'", 'toggleAllTriggers' => 'true', 'ignoreEnterOnFocus' => 'true', 'toggleOffOnEscPress' => 'true', 'toggleOffOnOutsideClick' => 'true', 'triggerElements' => [ "'click @togglableTriggers'", ] ] ]; $behavior[] = [ 'behaviorClass' => 'LiquidEffectsSlideToggleBehavior', 'options' => [ 'changePropPrefix' => "'lqdSearchToggle-$el_id'", ] ]; return $behavior; } protected function register_controls() { // General Section $this->start_controls_section( 'general_section', [ 'label' => __( 'Header search', 'aihub-core' ), ] ); $this->add_control( 'style', [ 'label' => __( 'Style', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'default' => 'classic', 'options' => [ 'classic' => __( 'Classic', 'aihub-core' ), 'slide' => __( 'Slide', 'aihub-core' ), ], 'prefix_class' => 'lqd-search-style-', 'render_type' => 'template' ] ); $this->add_control( 'search_type', [ 'label' => __( 'Search by', 'aihub-core' ), 'type' => Controls_Manager::SELECT, 'default' => 'post', 'options' => [ 'all' => __( 'All', 'aihub-core' ), 'post' => __( 'Post', 'aihub-core' ), 'product' => __( 'Product', 'aihub-core' ), 'custom' => __( 'Custom', 'aihub-core' ), ], ] ); $this->add_control( 'custom_search_type', [ 'label' => __( 'Custom post type', 'aihub-core' ), 'description' => __( 'Enter the custom post type slug', 'aihub-core' ), 'placeholder' => 'my-post-type-slug', 'type' => Controls_Manager::TEXT, 'condition' => [ 'search_type' => 'custom', ], ] ); $this->add_control( 'description', [ 'label' => __( 'Description', 'aihub-core' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Type and hit enter', 'aihub-core' ), 'placeholder' => __( 'Description under serchform', 'aihub-core' ), ] ); $this->end_controls_section(); \LQD_Elementor_Helper::add_style_controls( $this, 'search', [ 'container' => [ 'controls' => [ [ 'type' => 'liquid_background_css', 'css_var' => '--lqd-search-dropdown-bg' ], [ 'type' => 'border', 'css_var' => '--lqd-search-dropdown-br' ], [ 'type' => 'border_radius', 'css_var' => '--lqd-search-dropdown-brr' ], [ 'type' => 'box_shadow', 'css_var' => '--lqd-search-dropdown-bs' ], ], 'plural_heading' => false, ], 'input' => [ 'label' => 'Input', 'controls' => [ [ 'type' => 'padding', 'css_var' => '--lqd-search-input-p' ], [ 'type' => 'liquid_color', 'css_var' => '--lqd-search-input-color' ], [ 'type' => 'liquid_background_css', 'css_var' => '--lqd-search-input-bg' ], [ 'type' => 'border', 'css_var' => '--lqd-search-input-br' ], [ 'type' => 'border_radius', 'css_var' => '--lqd-search-input-brr' ], [ 'type' => 'box_shadow', 'css_var' => '--lqd-search-input-bs' ], ], 'plural_heading' => false, 'state_tabs' => [ 'normal', 'focus' ], ], ], ); \LQD_Elementor_Trigger::register_controls( $this, 'ib_' ); } protected function render() { $settings = $this->get_settings_for_display(); $style = $settings['style']; $search_type = $settings['search_type']; $dropdown_classname = [ 'lqd-dropdown', 'lqd-search-dropdown', 'lqd-togglable-element', 'hidden', 'w-full', 'flex-col', 'overflow-hidden', 'backface-hidden', '[&.lqd-is-active:flex]' ]; $input_icon_classname = [ 'lqd-input-icon', 'inline-block', 'absolute', 'top-1/2', 'lqd-transform', '-translate-y-1/2' ]; if ( $search_type == 'custom' && empty( $settings['custom_search_type'] ) ) { $search_type = 'all'; } else if ( $search_type == 'custom' && !empty( $settings['custom_search_type'] ) ) { $search_type = $settings['custom_search_type']; } if ( $style === 'slide' ) { $dropdown_classname[] = 'h-full fixed top-0 start-0 end-0'; $input_icon_classname[] = 'end-0'; } else { $dropdown_classname[] = 'absolute end-0'; $input_icon_classname[] = 'start-0'; } $this->add_render_attribute( 'dropdown', [ 'class' => $dropdown_classname ] ); $this->add_render_attribute( 'input_icon', [ 'class' => $input_icon_classname ] ); \LQD_Elementor_Trigger::render( $this, 'ib_' ); ?>
print_render_attribute_string( 'dropdown' ) ?>>
widgets_manager->register( new LQD_Header_Search() );