| 1 |
<?php |
| 2 |
namespace Elementor; |
| 3 |
|
| 4 |
class LP_Elementor_Widget_Become_A_Teacher extends LP_Elementor_Widget_Base { |
| 5 |
|
| 6 |
public function get_name() { |
| 7 |
return 'learnpress_become_a_teacher'; |
| 8 |
} |
| 9 |
|
| 10 |
public function get_title() { |
| 11 |
return esc_html__( 'Become a teacher', 'learnpress' ); |
| 12 |
} |
| 13 |
|
| 14 |
public function get_keywords() { |
| 15 |
return array( 'learnpress', 'teacher', 'become' ); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_icon() { |
| 19 |
return 'eicon-site-logo'; |
| 20 |
} |
| 21 |
|
| 22 |
protected function register_controls() { |
| 23 |
$this->start_controls_section( |
| 24 |
'section_content', |
| 25 |
array( |
| 26 |
'label' => esc_html__( 'Content', 'learnpress' ), |
| 27 |
) |
| 28 |
); |
| 29 |
|
| 30 |
$this->add_control( |
| 31 |
'title', |
| 32 |
array( |
| 33 |
'label' => esc_html__( 'Title', 'learnpress' ), |
| 34 |
'type' => Controls_Manager::TEXT, |
| 35 |
'default' => esc_html__( 'Become a teacher', 'learnpress' ), |
| 36 |
) |
| 37 |
); |
| 38 |
|
| 39 |
$this->add_control( |
| 40 |
'description', |
| 41 |
array( |
| 42 |
'label' => esc_html__( 'Description', 'learnpress' ), |
| 43 |
'type' => Controls_Manager::TEXTAREA, |
| 44 |
'default' => esc_html__( 'Fill in your information and send us to become a teacher.', 'learnpress' ), |
| 45 |
) |
| 46 |
); |
| 47 |
|
| 48 |
$this->add_control( |
| 49 |
'submit_button_text', |
| 50 |
array( |
| 51 |
'label' => esc_html__( 'Button text', 'learnpress' ), |
| 52 |
'type' => Controls_Manager::TEXT, |
| 53 |
'default' => esc_html__( 'Submit', 'learnpress' ), |
| 54 |
) |
| 55 |
); |
| 56 |
|
| 57 |
$this->add_control( |
| 58 |
'submit_button_process_text', |
| 59 |
array( |
| 60 |
'label' => esc_html__( 'Button Processing text', 'learnpress' ), |
| 61 |
'type' => Controls_Manager::TEXT, |
| 62 |
'default' => esc_html__( 'Processing', 'learnpress' ), |
| 63 |
) |
| 64 |
); |
| 65 |
|
| 66 |
$this->end_controls_section(); |
| 67 |
|
| 68 |
$this->register_control_style_form_title( '#learn-press-become-teacher-form h3' ); |
| 69 |
$this->register_controls_style(); |
| 70 |
$this->register_control_style_form_field( '.become-teacher-fields', '.form-field' ); |
| 71 |
$this->register_control_style_form_button( '.become-teacher-form button[type="submit"]' ); |
| 72 |
$this->register_control_style_message(); |
| 73 |
} |
| 74 |
|
| 75 |
protected function register_controls_style() { |
| 76 |
|
| 77 |
$this->start_controls_section( |
| 78 |
'section_style_description', |
| 79 |
array( |
| 80 |
'label' => esc_html__( 'Description', 'learnpress' ), |
| 81 |
'tab' => Controls_Manager::TAB_STYLE, |
| 82 |
) |
| 83 |
); |
| 84 |
|
| 85 |
$this->add_responsive_control( |
| 86 |
'description_align', |
| 87 |
array( |
| 88 |
'label' => esc_html__( 'Alignment', 'thim-elementorkits' ), |
| 89 |
'type' => Controls_Manager::CHOOSE, |
| 90 |
'options' => array( |
| 91 |
'left' => array( |
| 92 |
'title' => esc_html__( 'Left', 'thim-elementorkits' ), |
| 93 |
'icon' => 'eicon-text-align-left', |
| 94 |
), |
| 95 |
'center' => array( |
| 96 |
'title' => esc_html__( 'Center', 'thim-elementorkits' ), |
| 97 |
'icon' => 'eicon-text-align-center', |
| 98 |
), |
| 99 |
'right' => array( |
| 100 |
'title' => esc_html__( 'Right', 'thim-elementorkits' ), |
| 101 |
'icon' => 'eicon-text-align-right', |
| 102 |
), |
| 103 |
), |
| 104 |
'selectors' => array( |
| 105 |
'{{WRAPPER}} #learn-press-become-teacher-form .become-teacher-form__description' => 'text-align: {{VALUE}}', |
| 106 |
), |
| 107 |
) |
| 108 |
); |
| 109 |
|
| 110 |
$this->add_control( |
| 111 |
'description_color', |
| 112 |
array( |
| 113 |
'label' => esc_html__( 'Color', 'thim-elementorkits' ), |
| 114 |
'type' => Controls_Manager::COLOR, |
| 115 |
'selectors' => array( |
| 116 |
'{{WRAPPER}} #learn-press-become-teacher-form .become-teacher-form__description' => 'color: {{VALUE}}', |
| 117 |
), |
| 118 |
) |
| 119 |
); |
| 120 |
|
| 121 |
$this->add_group_control( |
| 122 |
Group_Control_Typography::get_type(), |
| 123 |
array( |
| 124 |
'name' => 'description_typography', |
| 125 |
'selector' => '{{WRAPPER}} #learn-press-become-teacher-form .become-teacher-form__description', |
| 126 |
) |
| 127 |
); |
| 128 |
|
| 129 |
$this->add_responsive_control( |
| 130 |
'description_spacing', |
| 131 |
array( |
| 132 |
'label' => esc_html__( 'Spacing', 'thim-elementorkits' ), |
| 133 |
'type' => Controls_Manager::SLIDER, |
| 134 |
'range' => array( |
| 135 |
'px' => array( |
| 136 |
'max' => 100, |
| 137 |
), |
| 138 |
), |
| 139 |
'selectors' => array( |
| 140 |
'{{WRAPPER}} #learn-press-become-teacher-form .become-teacher-form__description' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 141 |
), |
| 142 |
) |
| 143 |
); |
| 144 |
|
| 145 |
$this->end_controls_section(); |
| 146 |
} |
| 147 |
|
| 148 |
public function render() { |
| 149 |
$settings = $this->get_settings_for_display(); |
| 150 |
|
| 151 |
echo do_shortcode( '[learn_press_become_teacher_form title="' . $settings['title'] . '" description="' . $settings['description'] . '" submit_button_text="' . esc_html( $settings['submit_button_text'] ) . '" submit_button_process_text="' . $settings['submit_button_process_text'] . '"]' ); |
| 152 |
} |
| 153 |
} |
| 154 |
|