| 1 |
<?php |
| 2 |
|
| 3 |
namespace Borderless\Widgets; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 6 |
|
| 7 |
use Elementor\Widget_Base; |
| 8 |
use Elementor\Controls_Manager; |
| 9 |
use Elementor\Group_Control_Image_Size; |
| 10 |
use Elementor\Utils; |
| 11 |
|
| 12 |
class Contact_Form_7 extends Widget_Base { |
| 13 |
|
| 14 |
public function get_name() { |
| 15 |
return 'borderless-elementor-contact-form-7'; |
| 16 |
} |
| 17 |
|
| 18 |
public function get_title() { |
| 19 |
return 'Contact Form 7'; |
| 20 |
} |
| 21 |
|
| 22 |
public function get_icon() { |
| 23 |
return 'borderless-icon-contact-form-7'; |
| 24 |
} |
| 25 |
|
| 26 |
public function get_categories() { |
| 27 |
return [ 'borderless' ]; |
| 28 |
} |
| 29 |
|
| 30 |
protected function _register_controls() { |
| 31 |
|
| 32 |
$this->start_controls_section( |
| 33 |
'section_content', |
| 34 |
[ |
| 35 |
'label' => esc_html__( 'Contact Form 7', 'borderless' ), |
| 36 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 37 |
] |
| 38 |
); |
| 39 |
|
| 40 |
$this->add_control( |
| 41 |
'contact_form_7', |
| 42 |
[ |
| 43 |
'label' => esc_html__( 'Select Contact Form', 'borderless' ), |
| 44 |
'description' => esc_html__('Contact form 7 - plugin must be installed and there must be some contact forms made with the contact form 7','borderless'), |
| 45 |
'type' => Controls_Manager::SELECT2, |
| 46 |
'multiple' => false, |
| 47 |
'label_block' => 1, |
| 48 |
'options' => get_contact_form_7_posts(), |
| 49 |
] |
| 50 |
); |
| 51 |
|
| 52 |
$this->end_controls_section(); |
| 53 |
} |
| 54 |
|
| 55 |
protected function render() { |
| 56 |
|
| 57 |
$settings = $this->get_settings_for_display(); |
| 58 |
|
| 59 |
if(!empty($settings['contact_form_7'])){ ?> |
| 60 |
<div class="borderless-elementor-contact-form-7-widget"> |
| 61 |
<div class="borderless-elementor-contact-form-7" contact-form-7-id="<?php echo wp_kses( ( $settings['contact_form_7'] ), true ); ?>"> |
| 62 |
<?php echo do_shortcode('[contact-form-7 id="'.wp_kses( ( $settings['contact_form_7'] ), true ).'"]'); ?> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
<?php } |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
protected function _content_template() { |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
} |