'wpcf7_contact_form', 'posts_per_page' => -1 ); $contact_forms = array(); if( $data = get_posts($args)){ foreach($data as $key){ $contact_forms[$key->ID] = $key->post_title; } }else{ $contact_forms['0'] = esc_html__('No Contact Form found', 'addonnest'); } return $contact_forms; } class AddonNest_Widget_Call_Contact_Form extends \Elementor\Widget_Base { public function get_name() { return 'addonnest-call-contact-form'; } public function get_title() { return __( 'Call Contact Form', 'addonnest' ); } public function get_icon() { return 'eicon-form-horizontal'; } public function get_categories() { return [ 'addonnest-elementor' ]; } protected function register_controls() { $this->start_controls_section( 'section_title', [ 'label' => __( 'Call Contact Form', 'addonnest' ) ] ); $this->add_control( 'callto_action_title', [ 'label' => __( 'Title', 'addonnest' ), 'type' => \Elementor\Controls_Manager::TEXT, 'label_block' => true, 'placeholder' => __( 'Enter title', 'addonnest' ), 'default' => __( 'This is heading', 'addonnest' ), ] ); $this->add_control( 'subtitle_content', [ 'label' => __( 'Sub Title Content', 'addonnest' ), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'label_block' => true, 'placeholder' => __( 'Enter Sub Title', 'addonnest' ), 'default' => __( 'Write your sub title content of this section.', 'addonnest' ), ] ); $this->add_control( 'action_button', [ 'label' => __( 'Button Name', 'addonnest' ), 'type' => \Elementor\Controls_Manager::TEXT, 'label_block' => true, 'placeholder' => __( 'Button Name', 'addonnest' ), 'default' => __( 'Contact us Today', 'addonnest' ), ] ); $this->add_control( 'contact_button', [ 'label' => __( 'Contact Form', 'addonnest' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '', 'options' => addonnest_contact_form(), ] ); $this->end_controls_section(); # Option End $this->start_controls_section( 'section_title_style', [ 'label' => __( 'Title', 'addonnest' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'section_bg_color', [ 'label' => __( 'Section Background Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .call_action_wrap-wrap' => 'background: {{VALUE}};', ], ] ); $this->add_responsive_control( 'call_form_padding', [ 'label' => __( 'Padding', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .call_action_wrap-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'contact_form_border_radius', [ 'label' => esc_html__( 'Border Radius', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .call_action_wrap-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'title_color', [ 'label' => __( 'Text Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .call_action_wrap h3' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'typography', 'selector' => '{{WRAPPER}} .call_action_wrap h3', ] ); $this->end_controls_section(); # Title Section end 1 # Sub Title Section 2 $this->start_controls_section( 'section_subtitle_style', [ 'label' => __( 'Sub Title', 'addonnest' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'subtitle_color', [ 'label' => __( 'Subtitle Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .call_action_wrap span' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'typography2', 'selector' => '{{WRAPPER}} .call_action_wrap span', ] ); $this->end_controls_section(); # Subtitle part 2 end # Button Style $this->start_controls_section( 'action_button_style', [ 'label' => __( 'Button Style', 'addonnest' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'button_color', [ 'label' => __( 'Button Text Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .btn.btn-call_action_wrap' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_color', [ 'label' => __( 'Button Text Hover Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .btn.btn-call_action_wrap:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background', [ 'label' => __( 'Button BG Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .btn.btn-call_action_wrap' => 'background: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_background', [ 'label' => __( 'Button Hover BG Color', 'addonnest' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .btn.btn-call_action_wrap:hover' => 'background: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'typography3', 'selector' => '{{WRAPPER}} .btn.btn-call_action_wrap', ] ); $this->add_responsive_control( 'call_form_btn_padding', [ 'label' => __( 'Padding', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .btn.btn-call_action_wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'contact_form_btn_border_radius', [ 'label' => esc_html__( 'Border Radius', 'addonnest' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .btn.btn-call_action_wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); # Subtitle part 2 end } protected function render( ) { $settings = $this->get_settings(); $contact_button = $settings['contact_button']; ?>
widgets_manager->register_widget_type( new AddonNest_Widget_Call_Contact_Form() );