start_controls_section( 'section_options', [ 'label' => esc_html__( 'Options', 'adirectory' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'ajax_filter', [ 'label' => esc_html__( 'Ajax Filters ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => empty( adqs_get_setting_option( 'ajax_filters' ) ) ? 'false' : 'true', ] ); $this->add_control( 'nav_bar_show', [ 'label' => esc_html__( 'Nav Bar Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'search_bar_show', [ 'label' => esc_html__( 'Search Bar Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'sort_by_show', [ 'label' => esc_html__( 'Sort By Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'reset_filter', [ 'label' => esc_html__( 'Reset Filter Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'per_page', [ 'label' => esc_html__( 'Agents Per Page', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 100, 'step' => 1, 'default' => 8, 'description' => esc_html__( 'Number of agents to display per page', 'adirectory' ), ] ); $this->add_control( 'directory_dropdown', [ 'label' => esc_html__( 'Directory Dropdown After', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 2, 'max' => 20, 'step' => 1, 'default' => 4, 'description' => esc_html__( 'Show dropdown after this many directory types', 'adirectory' ), ] ); $this->end_controls_section(); // end: Section /* ----------------------- SLIDER OPTIONS END -------------------------*/ $this->start_controls_section( 'golbal_color', [ 'label' => esc_html__( 'Global Color', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'golbal_primary_color', [ 'label' => esc_html__( 'Primary Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .adqs-agents-area' => '--color-primary: {{VALUE}}', ], ] ); $this->add_control( 'golbal_secondary_color', [ 'label' => esc_html__( 'Secondary Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .adqs-agents-area' => '--color-secondary: {{VALUE}}', ], ] ); $this->end_controls_section(); } /** * Render agents widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); // Get the basic shortcode attributes $per_page = $settings['per_page'] ?? 8; $directory_dropdown = $settings['directory_dropdown'] ?? 4; $ajax_filter = $settings['ajax_filter'] ?? 'true'; $nav_bar_show = $settings['nav_bar_show'] ?? 'true'; $search_bar_show = $settings['search_bar_show'] ?? 'true'; $sort_by_show = $settings['sort_by_show'] ?? 'true'; $reset_filter = $settings['reset_filter'] ?? 'true'; $style_type = $settings['style_type'] ?? ''; // Generate the shortcode with proper attributes $shortcode = "[adqs_agents per_page='{$per_page}' ajax_filter='{$ajax_filter}' nav_bar_show='{$nav_bar_show}' search_bar_show='{$search_bar_show}' sort_by_show='{$sort_by_show}' reset_filter='{$reset_filter}' directory_dropdown='{$directory_dropdown}' style_type='{$style_type}' from_addon='true' ]"; // Output the shortcode echo do_shortcode( $shortcode ); } } Plugin::instance()->widgets_manager->register( new Agents() );