| @@ -1,433 +1,477 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget; |
| 3 | 3 | |
| 4 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | - exit; // Exit if accessed directly | |
| 5 | + exit; // Exit if accessed directly | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -use Elementor\Widget_Base; | |
| 8 | +use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget; | |
| 9 | 9 | use Elementor\Controls_Manager; |
| 10 | 10 | use Elementor\Group_Control_Typography; |
| 11 | 11 | use Elementor\Plugin; |
| 12 | 12 | |
| 13 | -class Feedback extends Widget_Base { | |
| 13 | +class Feedback extends BaseWidget { | |
| 14 | 14 | |
| 15 | - public function get_name() { | |
| 16 | - return 'betterdocs-feedback'; | |
| 17 | - } | |
| 15 | + public function get_name() { | |
| 16 | + return 'betterdocs-feedback'; | |
| 17 | + } | |
| 18 | 18 | |
| 19 | - public function get_title() { | |
| 20 | - return __( 'Doc Feedback', 'betterdocs' ); | |
| 21 | - } | |
| 19 | + public function get_title() { | |
| 20 | + return __( 'Doc Feedback', 'betterdocs' ); | |
| 21 | + } | |
| 22 | 22 | |
| 23 | - public function get_icon() { | |
| 24 | - return 'betterdocs-icon-feedback'; | |
| 25 | - } | |
| 23 | + public function get_icon() { | |
| 24 | + return 'betterdocs-icon-feedback'; | |
| 25 | + } | |
| 26 | 26 | |
| 27 | - public function get_categories() { | |
| 28 | - return ['betterdocs-elements-single']; | |
| 29 | - } | |
| 27 | + public function get_categories() { | |
| 28 | + return [ 'betterdocs-elements-single' ]; | |
| 29 | + } | |
| 30 | 30 | |
| 31 | - public function get_keywords() { | |
| 32 | - return ['betterdocs-elements', 'feedback', 'betterdocs', 'docs']; | |
| 33 | - } | |
| 31 | + public function get_keywords() { | |
| 32 | + return [ 'betterdocs-elements', 'feedback', 'betterdocs', 'docs' ]; | |
| 33 | + } | |
| 34 | 34 | |
| 35 | - public function get_style_depends() { | |
| 36 | - return ['betterdocs-feedback-form']; | |
| 37 | - } | |
| 35 | + public function get_style_depends() { | |
| 36 | + return [ 'betterdocs-feedback-form' ]; | |
| 37 | + } | |
| 38 | 38 | |
| 39 | - public function get_custom_help_url() { | |
| 40 | - return 'https://betterdocs.co/docs/single-doc-in-elementor'; | |
| 41 | - } | |
| 39 | + public function get_custom_help_url() { | |
| 40 | + return 'https://betterdocs.co/docs/single-doc-in-elementor'; | |
| 41 | + } | |
| 42 | 42 | |
| 43 | - protected function register_controls() { | |
| 43 | + protected function register_controls() { | |
| 44 | 44 | |
| 45 | - /** | |
| 46 | - * ---------------------------------------------------------- | |
| 47 | - * Section: Layout Options | |
| 48 | - * ---------------------------------------------------------- | |
| 49 | - */ | |
| 50 | - $this->start_controls_section( | |
| 51 | - 'section_layout_options', | |
| 52 | - [ | |
| 53 | - 'label' => __( 'General ', 'betterdocs' ) | |
| 54 | - ] | |
| 55 | - ); | |
| 45 | + /** | |
| 46 | + * ---------------------------------------------------------- | |
| 47 | + * Section: Layout Options | |
| 48 | + * ---------------------------------------------------------- | |
| 49 | + */ | |
| 50 | + $this->start_controls_section( | |
| 51 | + 'section_layout_options', | |
| 52 | + [ | |
| 53 | + 'label' => __( 'General ', 'betterdocs' ) | |
| 54 | + ] | |
| 55 | + ); | |
| 56 | 56 | |
| 57 | - $this->add_control( | |
| 58 | - 'feedback_link_title', | |
| 59 | - [ | |
| 60 | - 'label' => __( 'Content', 'betterdocs' ), | |
| 61 | - 'type' => Controls_Manager::TEXT, | |
| 62 | - 'default' => esc_html__( 'Still stuck? How can we help?', 'betterdocs' ) | |
| 63 | - ] | |
| 64 | - ); | |
| 65 | - $this->add_control( | |
| 66 | - 'feedback_form_title', | |
| 67 | - [ | |
| 68 | - 'label' => __( 'Feedback Form Title', 'betterdocs' ), | |
| 69 | - 'type' => Controls_Manager::TEXT, | |
| 70 | - 'default' => esc_html__( 'How can we help?', 'betterdocs' ) | |
| 71 | - ] | |
| 72 | - ); | |
| 73 | 57 | |
| 74 | - $this->add_control( | |
| 75 | - 'feedback_form_button_text', | |
| 76 | - [ | |
| 77 | - 'label' => __( 'Button Text', 'betterdocs' ), | |
| 78 | - 'type' => Controls_Manager::TEXT, | |
| 79 | - 'default' => 'Send', | |
| 80 | - 'placeholder' => __( 'Enter button text', 'betterdocs' ), | |
| 81 | - 'title' => __( 'Enter button text here', 'betterdocs' ) | |
| 82 | - ] | |
| 83 | - ); | |
| 58 | + $this->add_control( | |
| 59 | + 'feedback_form_name_label_text', | |
| 60 | + [ | |
| 61 | + 'label' => __( 'Label Name Text', 'betterdocs' ), | |
| 62 | + 'type' => Controls_Manager::TEXT, | |
| 63 | + 'default' => esc_html__( 'Name:', 'betterdocs' ) | |
| 64 | + ] | |
| 65 | + ); | |
| 84 | 66 | |
| 85 | - $this->end_controls_section(); | |
| 86 | 67 | |
| 87 | - $this->start_controls_section( | |
| 88 | - 'section_card_settings_text', | |
| 89 | - [ | |
| 90 | - 'label' => __( 'Text', 'betterdocs' ), | |
| 91 | - 'tab' => Controls_Manager::TAB_STYLE | |
| 92 | - ] | |
| 93 | - ); | |
| 68 | + $this->add_control( | |
| 69 | + 'feedback_form_email_label_text', | |
| 70 | + [ | |
| 71 | + 'label' => __( 'Label Email Text', 'betterdocs' ), | |
| 72 | + 'type' => Controls_Manager::TEXT, | |
| 73 | + 'default' => esc_html__( 'Email:', 'betterdocs' ) | |
| 74 | + ] | |
| 75 | + ); | |
| 94 | 76 | |
| 95 | - $this->add_control( | |
| 96 | - 'feedback_text_color', | |
| 97 | - [ | |
| 98 | - 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 99 | - 'type' => Controls_Manager::COLOR, | |
| 100 | - 'selectors' => [ | |
| 101 | - '{{WRAPPER}} .feedback-form-link' => 'color: {{VALUE}};' | |
| 102 | - ] | |
| 103 | - ] | |
| 104 | - ); | |
| 77 | + $this->add_control( | |
| 78 | + 'feedback_form_message_label_text', | |
| 79 | + [ | |
| 80 | + 'label' => __( 'Label Message Text', 'betterdocs' ), | |
| 81 | + 'type' => Controls_Manager::TEXT, | |
| 82 | + 'default' => esc_html__( 'Message:', 'betterdocs' ) | |
| 83 | + ] | |
| 84 | + ); | |
| 105 | 85 | |
| 106 | - $this->add_group_control( | |
| 107 | - Group_Control_Typography::get_type(), | |
| 108 | - [ | |
| 109 | - 'name' => 'feedback_text_typography', | |
| 110 | - 'selector' => '{{WRAPPER}} .feedback-form-link' | |
| 111 | - ] | |
| 112 | - ); | |
| 86 | + $this->add_control( | |
| 87 | + 'feedback_link_title', | |
| 88 | + [ | |
| 89 | + 'label' => __( 'Content', 'betterdocs' ), | |
| 90 | + 'type' => Controls_Manager::TEXT, | |
| 91 | + 'default' => esc_html__( 'Still stuck? How can we help?', 'betterdocs' ) | |
| 92 | + ] | |
| 93 | + ); | |
| 94 | + $this->add_control( | |
| 95 | + 'feedback_form_title', | |
| 96 | + [ | |
| 97 | + 'label' => __( 'Feedback Form Title', 'betterdocs' ), | |
| 98 | + 'type' => Controls_Manager::TEXT, | |
| 99 | + 'default' => esc_html__( 'How can we help?', 'betterdocs' ) | |
| 100 | + ] | |
| 101 | + ); | |
| 113 | 102 | |
| 114 | - $this->end_controls_section(); | |
| 103 | + $this->add_control( | |
| 104 | + 'feedback_form_button_text', | |
| 105 | + [ | |
| 106 | + 'label' => __( 'Button Text', 'betterdocs' ), | |
| 107 | + 'type' => Controls_Manager::TEXT, | |
| 108 | + 'default' => 'Send', | |
| 109 | + 'placeholder' => __( 'Enter button text', 'betterdocs' ), | |
| 110 | + 'title' => __( 'Enter button text here', 'betterdocs' ) | |
| 111 | + ] | |
| 112 | + ); | |
| 115 | 113 | |
| 116 | - $this->icon_section(); | |
| 114 | + $this->add_control( | |
| 115 | + 'feedback_form_icon_image', | |
| 116 | + [ | |
| 117 | + 'label' => esc_html__( 'Choose Feedback Icon Image', 'betterdocs' ), | |
| 118 | + 'type' => Controls_Manager::MEDIA, | |
| 119 | + 'default' => [ | |
| 120 | + 'url' => '', | |
| 121 | + ], | |
| 122 | + ] | |
| 123 | + ); | |
| 117 | 124 | |
| 118 | - $this->feedback_form(); | |
| 119 | - } | |
| 125 | + $this->end_controls_section(); | |
| 120 | 126 | |
| 121 | - public function icon_section() { | |
| 122 | - $this->start_controls_section( | |
| 123 | - 'section_icon_options', | |
| 124 | - [ | |
| 125 | - 'label' => __( 'Icon ', 'betterdocs' ), | |
| 126 | - 'tab' => Controls_Manager::TAB_STYLE | |
| 127 | - ] | |
| 128 | - ); | |
| 127 | + $this->start_controls_section( | |
| 128 | + 'section_card_settings_text', | |
| 129 | + [ | |
| 130 | + 'label' => __( 'Text', 'betterdocs' ), | |
| 131 | + 'tab' => Controls_Manager::TAB_STYLE | |
| 132 | + ] | |
| 133 | + ); | |
| 129 | 134 | |
| 130 | - $this->add_control( | |
| 131 | - 'feedback_icon_color', | |
| 132 | - [ | |
| 133 | - 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 134 | - 'type' => Controls_Manager::COLOR | |
| 135 | - ] | |
| 136 | - ); | |
| 135 | + $this->add_control( | |
| 136 | + 'feedback_text_color', | |
| 137 | + [ | |
| 138 | + 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 139 | + 'type' => Controls_Manager::COLOR, | |
| 140 | + 'selectors' => [ | |
| 141 | + '{{WRAPPER}} .feedback-form-link' => 'color: {{VALUE}};' | |
| 142 | + ] | |
| 143 | + ] | |
| 144 | + ); | |
| 137 | 145 | |
| 138 | - $this->add_control( | |
| 139 | - 'feedback_text_icon_size', | |
| 140 | - [ | |
| 141 | - 'label' => __( 'Size', 'betterdocs' ), | |
| 142 | - 'type' => Controls_Manager::SLIDER, | |
| 143 | - 'size_units' => ['px'], | |
| 144 | - 'range' => [ | |
| 145 | - 'px' => [ | |
| 146 | - 'max' => 1000, | |
| 147 | - 'step' => 1 | |
| 148 | - ] | |
| 149 | - ], | |
| 150 | - 'selectors' => [ | |
| 151 | - '{{WRAPPER}} .feedback-form-icon svg' => 'width: {{SIZE}}px;height: {{SIZE}}px;' | |
| 152 | - ] | |
| 153 | - ] | |
| 154 | - ); | |
| 146 | + $this->add_group_control( | |
| 147 | + Group_Control_Typography::get_type(), | |
| 148 | + [ | |
| 149 | + 'name' => 'feedback_text_typography', | |
| 150 | + 'selector' => '{{WRAPPER}} .feedback-form-link' | |
| 151 | + ] | |
| 152 | + ); | |
| 155 | 153 | |
| 156 | - $this->end_controls_section(); | |
| 157 | - } | |
| 154 | + $this->end_controls_section(); | |
| 158 | 155 | |
| 159 | - public function feedback_form() { | |
| 160 | - /** | |
| 161 | - * ---------------------------------------------------------- | |
| 162 | - * Section: Box Styles | |
| 163 | - * ---------------------------------------------------------- | |
| 164 | - */ | |
| 165 | - $this->start_controls_section( | |
| 166 | - 'section_card_settings', | |
| 167 | - [ | |
| 168 | - 'label' => __( 'FeedBack Form', 'betterdocs' ), | |
| 169 | - 'tab' => Controls_Manager::TAB_STYLE | |
| 170 | - ] | |
| 171 | - ); | |
| 156 | + $this->icon_section(); | |
| 172 | 157 | |
| 173 | - $this->add_control( | |
| 174 | - 'feedback_form_width', | |
| 175 | - [ | |
| 176 | - 'label' => __( 'Width', 'betterdocs' ), | |
| 177 | - 'type' => Controls_Manager::SLIDER, | |
| 178 | - 'size_units' => ['px'], | |
| 179 | - 'range' => [ | |
| 180 | - 'px' => [ | |
| 181 | - 'max' => 1000, | |
| 182 | - 'step' => 1 | |
| 183 | - ] | |
| 184 | - ], | |
| 185 | - 'selectors' => [ | |
| 186 | - '{{WRAPPER}} .betterdocs-modalwindow .modal-content' => 'width: {{SIZE}}px;' | |
| 187 | - ] | |
| 188 | - ] | |
| 189 | - ); | |
| 158 | + $this->feedback_form(); | |
| 159 | + } | |
| 190 | 160 | |
| 191 | - $this->add_control( | |
| 192 | - 'feedback_form_height', | |
| 193 | - [ | |
| 194 | - 'label' => __( 'Height', 'betterdocs' ), | |
| 195 | - 'type' => Controls_Manager::SLIDER, | |
| 196 | - 'size_units' => ['px'], | |
| 197 | - 'range' => [ | |
| 198 | - 'px' => [ | |
| 199 | - 'max' => 1000, | |
| 200 | - 'step' => 1 | |
| 201 | - ] | |
| 202 | - ], | |
| 203 | - 'selectors' => [ | |
| 204 | - '{{WRAPPER}} .betterdocs-modalwindow .modal-content' => 'height: {{SIZE}}px;' | |
| 205 | - ] | |
| 206 | - ] | |
| 207 | - ); | |
| 161 | + public function icon_section() { | |
| 162 | + $this->start_controls_section( | |
| 163 | + 'section_icon_options', | |
| 164 | + [ | |
| 165 | + 'label' => __( 'Icon ', 'betterdocs' ), | |
| 166 | + 'tab' => Controls_Manager::TAB_STYLE | |
| 167 | + ] | |
| 168 | + ); | |
| 208 | 169 | |
| 209 | - $this->add_control( | |
| 210 | - 'feedback_form_heading', | |
| 211 | - [ | |
| 212 | - 'label' => esc_html__( 'Heading', 'betterdocs' ), | |
| 213 | - 'type' => Controls_Manager::HEADING | |
| 214 | - ] | |
| 215 | - ); | |
| 170 | + $this->add_control( | |
| 171 | + 'feedback_icon_color', | |
| 172 | + [ | |
| 173 | + 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 174 | + 'type' => Controls_Manager::COLOR | |
| 175 | + ] | |
| 176 | + ); | |
| 216 | 177 | |
| 217 | - $this->add_control( | |
| 218 | - 'feedback_form_heading_color', | |
| 219 | - [ | |
| 220 | - 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 221 | - 'type' => Controls_Manager::COLOR, | |
| 222 | - 'selectors' => [ | |
| 223 | - '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' => 'color: {{VALUE}};' | |
| 224 | - ] | |
| 225 | - ] | |
| 226 | - ); | |
| 178 | + $this->add_control( | |
| 179 | + 'feedback_text_icon_size', | |
| 180 | + [ | |
| 181 | + 'label' => __( 'Size', 'betterdocs' ), | |
| 182 | + 'type' => Controls_Manager::SLIDER, | |
| 183 | + 'size_units' => [ 'px' ], | |
| 184 | + 'range' => [ | |
| 185 | + 'px' => [ | |
| 186 | + 'max' => 1000, | |
| 187 | + 'step' => 1 | |
| 188 | + ] | |
| 189 | + ], | |
| 190 | + 'selectors' => [ | |
| 191 | + '{{WRAPPER}} .feedback-form-icon svg' => 'width: {{SIZE}}px;height: {{SIZE}}px;', | |
| 192 | + '{{WRAPPER}} .feedback-form-icon img' => 'width: {{SIZE}}px;height: {{SIZE}}px;' | |
| 193 | + ] | |
| 194 | + ] | |
| 195 | + ); | |
| 227 | 196 | |
| 228 | - $this->add_group_control( | |
| 229 | - Group_Control_Typography::get_type(), | |
| 230 | - [ | |
| 231 | - 'name' => 'feedback_form_heading_typography', | |
| 232 | - 'selector' => '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' | |
| 233 | - ] | |
| 234 | - ); | |
| 197 | + $this->end_controls_section(); | |
| 198 | + } | |
| 235 | 199 | |
| 236 | - $this->add_responsive_control( | |
| 237 | - 'align', | |
| 238 | - [ | |
| 239 | - 'label' => __( 'Alignment', 'betterdocs' ), | |
| 240 | - 'type' => Controls_Manager::CHOOSE, | |
| 241 | - 'options' => [ | |
| 242 | - 'left' => [ | |
| 243 | - 'title' => __( 'Left', 'betterdocs' ), | |
| 244 | - 'icon' => 'eicon-text-align-left' | |
| 245 | - ], | |
| 246 | - 'center' => [ | |
| 247 | - 'title' => __( 'Center', 'betterdocs' ), | |
| 248 | - 'icon' => 'eicon-text-align-center' | |
| 249 | - ], | |
| 250 | - 'right' => [ | |
| 251 | - 'title' => __( 'Right', 'betterdocs' ), | |
| 252 | - 'icon' => 'eicon-text-align-right' | |
| 253 | - ], | |
| 254 | - 'justify' => [ | |
| 255 | - 'title' => __( 'Justified', 'betterdocs' ), | |
| 256 | - 'icon' => 'eicon-text-align-justify' | |
| 257 | - ] | |
| 258 | - ], | |
| 259 | - 'default' => '', | |
| 260 | - 'selectors' => [ | |
| 261 | - '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' => 'text-align: {{VALUE}};' | |
| 262 | - ] | |
| 263 | - ] | |
| 264 | - ); | |
| 200 | + public function feedback_form() { | |
| 201 | + /** | |
| 202 | + * ---------------------------------------------------------- | |
| 203 | + * Section: Box Styles | |
| 204 | + * ---------------------------------------------------------- | |
| 205 | + */ | |
| 206 | + $this->start_controls_section( | |
| 207 | + 'section_card_settings', | |
| 208 | + [ | |
| 209 | + 'label' => __( 'FeedBack Form', 'betterdocs' ), | |
| 210 | + 'tab' => Controls_Manager::TAB_STYLE | |
| 211 | + ] | |
| 212 | + ); | |
| 265 | 213 | |
| 266 | - $this->add_control( | |
| 267 | - 'feedback_form_label', | |
| 268 | - [ | |
| 269 | - 'label' => esc_html__( 'Lable', 'betterdocs' ), | |
| 270 | - 'type' => Controls_Manager::HEADING | |
| 271 | - ] | |
| 272 | - ); | |
| 214 | + $this->add_control( | |
| 215 | + 'feedback_form_width', | |
| 216 | + [ | |
| 217 | + 'label' => __( 'Width', 'betterdocs' ), | |
| 218 | + 'type' => Controls_Manager::SLIDER, | |
| 219 | + 'size_units' => [ 'px' ], | |
| 220 | + 'range' => [ | |
| 221 | + 'px' => [ | |
| 222 | + 'max' => 1000, | |
| 223 | + 'step' => 1 | |
| 224 | + ] | |
| 225 | + ], | |
| 226 | + 'selectors' => [ | |
| 227 | + '{{WRAPPER}} .betterdocs-modalwindow .modal-content' => 'width: {{SIZE}}px;' | |
| 228 | + ] | |
| 229 | + ] | |
| 230 | + ); | |
| 273 | 231 | |
| 274 | - $this->add_control( | |
| 275 | - 'feedback_form_label_color', | |
| 276 | - [ | |
| 277 | - 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 278 | - 'type' => Controls_Manager::COLOR, | |
| 279 | - 'selectors' => [ | |
| 280 | - '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label' => 'color: {{VALUE}};' | |
| 281 | - ] | |
| 282 | - ] | |
| 283 | - ); | |
| 232 | + $this->add_control( | |
| 233 | + 'feedback_form_height', | |
| 234 | + [ | |
| 235 | + 'label' => __( 'Height', 'betterdocs' ), | |
| 236 | + 'type' => Controls_Manager::SLIDER, | |
| 237 | + 'size_units' => [ 'px' ], | |
| 238 | + 'range' => [ | |
| 239 | + 'px' => [ | |
| 240 | + 'max' => 1000, | |
| 241 | + 'step' => 1 | |
| 242 | + ] | |
| 243 | + ], | |
| 244 | + 'selectors' => [ | |
| 245 | + '{{WRAPPER}} .betterdocs-modalwindow .modal-content' => 'height: {{SIZE}}px;' | |
| 246 | + ] | |
| 247 | + ] | |
| 248 | + ); | |
| 284 | 249 | |
| 285 | - $this->add_group_control( | |
| 286 | - Group_Control_Typography::get_type(), | |
| 287 | - [ | |
| 288 | - 'name' => 'feedback_form_label_typography', | |
| 289 | - 'selector' => '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label' | |
| 290 | - ] | |
| 291 | - ); | |
| 250 | + $this->add_control( | |
| 251 | + 'feedback_form_heading', | |
| 252 | + [ | |
| 253 | + 'label' => esc_html__( 'Heading', 'betterdocs' ), | |
| 254 | + 'type' => Controls_Manager::HEADING | |
| 255 | + ] | |
| 256 | + ); | |
| 292 | 257 | |
| 293 | - $this->add_control( | |
| 294 | - 'feedback_form_label_space', | |
| 295 | - [ | |
| 296 | - 'label' => __( 'Space', 'betterdocs' ), | |
| 297 | - 'type' => Controls_Manager::SLIDER, | |
| 298 | - 'size_units' => ['px'], | |
| 299 | - 'range' => [ | |
| 300 | - 'px' => [ | |
| 301 | - 'max' => 500, | |
| 302 | - 'step' => 1 | |
| 303 | - ] | |
| 304 | - ], | |
| 305 | - 'selectors' => [ | |
| 306 | - '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label input,{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label textarea' => 'margin-top: {{SIZE}}{{UNIT}};' | |
| 307 | - ] | |
| 308 | - ] | |
| 309 | - ); | |
| 258 | + $this->add_control( | |
| 259 | + 'feedback_form_heading_color', | |
| 260 | + [ | |
| 261 | + 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 262 | + 'type' => Controls_Manager::COLOR, | |
| 263 | + 'selectors' => [ | |
| 264 | + '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' => 'color: {{VALUE}};' | |
| 265 | + ] | |
| 266 | + ] | |
| 267 | + ); | |
| 310 | 268 | |
| 311 | - $this->add_control( | |
| 312 | - 'feedback_form_button', | |
| 313 | - [ | |
| 314 | - 'label' => esc_html__( 'Button', 'betterdocs' ), | |
| 315 | - 'type' => Controls_Manager::HEADING | |
| 316 | - ] | |
| 317 | - ); | |
| 269 | + $this->add_group_control( | |
| 270 | + Group_Control_Typography::get_type(), | |
| 271 | + [ | |
| 272 | + 'name' => 'feedback_form_heading_typography', | |
| 273 | + 'selector' => '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' | |
| 274 | + ] | |
| 275 | + ); | |
| 318 | 276 | |
| 319 | - $this->add_control( | |
| 320 | - 'feedback_form_button_background', | |
| 321 | - [ | |
| 322 | - 'label' => esc_html__( 'Background', 'betterdocs' ), | |
| 323 | - 'type' => Controls_Manager::COLOR, | |
| 324 | - 'selectors' => [ | |
| 325 | - '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'background-color: {{VALUE}};' | |
| 326 | - ] | |
| 327 | - ] | |
| 328 | - ); | |
| 277 | + $this->add_responsive_control( | |
| 278 | + 'align', | |
| 279 | + [ | |
| 280 | + 'label' => __( 'Alignment', 'betterdocs' ), | |
| 281 | + 'type' => Controls_Manager::CHOOSE, | |
| 282 | + 'options' => [ | |
| 283 | + 'left' => [ | |
| 284 | + 'title' => __( 'Left', 'betterdocs' ), | |
| 285 | + 'icon' => 'eicon-text-align-left' | |
| 286 | + ], | |
| 287 | + 'center' => [ | |
| 288 | + 'title' => __( 'Center', 'betterdocs' ), | |
| 289 | + 'icon' => 'eicon-text-align-center' | |
| 290 | + ], | |
| 291 | + 'right' => [ | |
| 292 | + 'title' => __( 'Right', 'betterdocs' ), | |
| 293 | + 'icon' => 'eicon-text-align-right' | |
| 294 | + ], | |
| 295 | + 'justify' => [ | |
| 296 | + 'title' => __( 'Justified', 'betterdocs' ), | |
| 297 | + 'icon' => 'eicon-text-align-justify' | |
| 298 | + ] | |
| 299 | + ], | |
| 300 | + 'default' => '', | |
| 301 | + 'selectors' => [ | |
| 302 | + '{{WRAPPER}} #betterdocs-form-modal .modal-inner .modal-content .feedback-form-title' => 'text-align: {{VALUE}};' | |
| 303 | + ] | |
| 304 | + ] | |
| 305 | + ); | |
| 329 | 306 | |
| 330 | - $this->add_control( | |
| 331 | - 'feedback_form_button_color', | |
| 332 | - [ | |
| 333 | - 'label' => esc_html__( 'Text Color', 'betterdocs' ), | |
| 334 | - 'type' => Controls_Manager::COLOR, | |
| 335 | - 'selectors' => [ | |
| 336 | - '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'color: {{VALUE}};' | |
| 337 | - ] | |
| 338 | - ] | |
| 339 | - ); | |
| 307 | + $this->add_control( | |
| 308 | + 'feedback_form_label', | |
| 309 | + [ | |
| 310 | + 'label' => esc_html__( 'Lable', 'betterdocs' ), | |
| 311 | + 'type' => Controls_Manager::HEADING | |
| 312 | + ] | |
| 313 | + ); | |
| 340 | 314 | |
| 341 | - $this->add_group_control( | |
| 342 | - Group_Control_Typography::get_type(), | |
| 343 | - [ | |
| 344 | - 'name' => 'feedback_form_button_typography', | |
| 345 | - 'selector' => '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' | |
| 346 | - ] | |
| 347 | - ); | |
| 315 | + $this->add_control( | |
| 316 | + 'feedback_form_label_color', | |
| 317 | + [ | |
| 318 | + 'label' => esc_html__( 'Color', 'betterdocs' ), | |
| 319 | + 'type' => Controls_Manager::COLOR, | |
| 320 | + 'selectors' => [ | |
| 321 | + '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label' => 'color: {{VALUE}};' | |
| 322 | + ] | |
| 323 | + ] | |
| 324 | + ); | |
| 348 | 325 | |
| 349 | - $this->add_responsive_control( | |
| 350 | - 'feedback_form_button_width', | |
| 351 | - [ | |
| 352 | - 'label' => esc_html__( 'Width', 'betterdocs' ), | |
| 353 | - 'type' => Controls_Manager::SLIDER, | |
| 354 | - 'size_units' => ['px', '%'], | |
| 355 | - 'range' => [ | |
| 356 | - 'px' => [ | |
| 357 | - 'min' => 0, | |
| 358 | - 'max' => 500, | |
| 359 | - 'step' => 1 | |
| 360 | - ], | |
| 361 | - '%' => [ | |
| 362 | - 'min' => 0, | |
| 363 | - 'max' => 100 | |
| 364 | - ] | |
| 365 | - ], | |
| 366 | - 'selectors' => [ | |
| 367 | - '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'width: {{SIZE}}{{UNIT}};' | |
| 368 | - ] | |
| 369 | - ] | |
| 370 | - ); | |
| 326 | + $this->add_group_control( | |
| 327 | + Group_Control_Typography::get_type(), | |
| 328 | + [ | |
| 329 | + 'name' => 'feedback_form_label_typography', | |
| 330 | + 'selector' => '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label' | |
| 331 | + ] | |
| 332 | + ); | |
| 371 | 333 | |
| 372 | - $this->add_control( | |
| 373 | - 'feedback_form_button_padding', | |
| 374 | - [ | |
| 375 | - 'label' => __( 'Padding', 'betterdocs' ), | |
| 376 | - 'type' => Controls_Manager::DIMENSIONS, | |
| 377 | - 'size_units' => ['px', 'em', '%'], | |
| 378 | - 'selectors' => [ | |
| 379 | - '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 380 | - ] | |
| 381 | - ] | |
| 382 | - ); | |
| 334 | + $this->add_control( | |
| 335 | + 'feedback_form_label_space', | |
| 336 | + [ | |
| 337 | + 'label' => __( 'Space', 'betterdocs' ), | |
| 338 | + 'type' => Controls_Manager::SLIDER, | |
| 339 | + 'size_units' => [ 'px' ], | |
| 340 | + 'range' => [ | |
| 341 | + 'px' => [ | |
| 342 | + 'max' => 500, | |
| 343 | + 'step' => 1 | |
| 344 | + ] | |
| 345 | + ], | |
| 346 | + 'selectors' => [ | |
| 347 | + '{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label input,{{WRAPPER}} .betterdocs-modalwindow .betterdocs-feedback-form label textarea' => 'margin-top: {{SIZE}}{{UNIT}};' | |
| 348 | + ] | |
| 349 | + ] | |
| 350 | + ); | |
| 383 | 351 | |
| 384 | - $this->add_responsive_control( | |
| 385 | - 'feedback_form_button_align', | |
| 386 | - [ | |
| 387 | - 'label' => __( 'Alignment', 'betterdocs' ), | |
| 388 | - 'type' => Controls_Manager::CHOOSE, | |
| 389 | - 'options' => [ | |
| 390 | - 'left' => [ | |
| 391 | - 'title' => __( 'Left', 'betterdocs' ), | |
| 392 | - 'icon' => 'eicon-text-align-left' | |
| 393 | - ], | |
| 394 | - 'center' => [ | |
| 395 | - 'title' => __( 'Center', 'betterdocs' ), | |
| 396 | - 'icon' => 'eicon-text-align-center' | |
| 397 | - ], | |
| 398 | - 'right' => [ | |
| 399 | - 'title' => __( 'Right', 'betterdocs' ), | |
| 400 | - 'icon' => 'eicon-text-align-right' | |
| 401 | - ], | |
| 402 | - 'justify' => [ | |
| 403 | - 'title' => __( 'Justified', 'betterdocs' ), | |
| 404 | - 'icon' => 'eicon-text-align-justify' | |
| 405 | - ] | |
| 406 | - ], | |
| 407 | - 'default' => '', | |
| 408 | - 'selectors' => [ | |
| 409 | - '{{WRAPPER}} .betterdocs-feedback-form .feedback-from-button' => 'text-align: {{VALUE}};' | |
| 410 | - ] | |
| 411 | - ] | |
| 412 | - ); | |
| 352 | + $this->add_control( | |
| 353 | + 'feedback_form_button', | |
| 354 | + [ | |
| 355 | + 'label' => esc_html__( 'Button', 'betterdocs' ), | |
| 356 | + 'type' => Controls_Manager::HEADING | |
| 357 | + ] | |
| 358 | + ); | |
| 413 | 359 | |
| 414 | - $this->end_controls_section(); | |
| 415 | - } | |
| 360 | + $this->add_control( | |
| 361 | + 'feedback_form_button_background', | |
| 362 | + [ | |
| 363 | + 'label' => esc_html__( 'Background', 'betterdocs' ), | |
| 364 | + 'type' => Controls_Manager::COLOR, | |
| 365 | + 'selectors' => [ | |
| 366 | + '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'background-color: {{VALUE}};' | |
| 367 | + ] | |
| 368 | + ] | |
| 369 | + ); | |
| 416 | 370 | |
| 417 | - protected function render() { | |
| 418 | - $settings = $this->get_settings_for_display(); | |
| 371 | + $this->add_control( | |
| 372 | + 'feedback_form_button_color', | |
| 373 | + [ | |
| 374 | + 'label' => esc_html__( 'Text Color', 'betterdocs' ), | |
| 375 | + 'type' => Controls_Manager::COLOR, | |
| 376 | + 'selectors' => [ | |
| 377 | + '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'color: {{VALUE}};' | |
| 378 | + ] | |
| 379 | + ] | |
| 380 | + ); | |
| 419 | 381 | |
| 420 | - betterdocs()->views->get( 'templates/feedback-parts/form', [ | |
| 421 | - 'widget' => $this, | |
| 422 | - 'settings' => $settings | |
| 423 | - ] ); | |
| 382 | + $this->add_group_control( | |
| 383 | + Group_Control_Typography::get_type(), | |
| 384 | + [ | |
| 385 | + 'name' => 'feedback_form_button_typography', | |
| 386 | + 'selector' => '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' | |
| 387 | + ] | |
| 388 | + ); | |
| 424 | 389 | |
| 425 | - if( Plugin::instance()->editor->is_edit_mode() ) { | |
| 426 | - $this->render_editor_script(); | |
| 427 | - } | |
| 428 | - } | |
| 390 | + $this->add_responsive_control( | |
| 391 | + 'feedback_form_button_width', | |
| 392 | + [ | |
| 393 | + 'label' => esc_html__( 'Width', 'betterdocs' ), | |
| 394 | + 'type' => Controls_Manager::SLIDER, | |
| 395 | + 'size_units' => [ 'px', '%' ], | |
| 396 | + 'range' => [ | |
| 397 | + 'px' => [ | |
| 398 | + 'min' => 0, | |
| 399 | + 'max' => 500, | |
| 400 | + 'step' => 1 | |
| 401 | + ], | |
| 402 | + '%' => [ | |
| 403 | + 'min' => 0, | |
| 404 | + 'max' => 100 | |
| 405 | + ] | |
| 406 | + ], | |
| 407 | + 'selectors' => [ | |
| 408 | + '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'width: {{SIZE}}{{UNIT}};' | |
| 409 | + ] | |
| 410 | + ] | |
| 411 | + ); | |
| 429 | 412 | |
| 430 | - public function render_editor_script() { | |
| 431 | - betterdocs()->views->get( 'templates/feedback-parts/editor' ); | |
| 432 | - } | |
| 413 | + $this->add_control( | |
| 414 | + 'feedback_form_button_padding', | |
| 415 | + [ | |
| 416 | + 'label' => __( 'Padding', 'betterdocs' ), | |
| 417 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 418 | + 'size_units' => [ 'px', 'em', '%' ], | |
| 419 | + 'selectors' => [ | |
| 420 | + '{{WRAPPER}} .betterdocs-feedback-form #feedback_form_submit_btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' | |
| 421 | + ] | |
| 422 | + ] | |
| 423 | + ); | |
| 424 | + | |
| 425 | + $this->add_responsive_control( | |
| 426 | + 'feedback_form_button_align', | |
| 427 | + [ | |
| 428 | + 'label' => __( 'Alignment', 'betterdocs' ), | |
| 429 | + 'type' => Controls_Manager::CHOOSE, | |
| 430 | + 'options' => [ | |
| 431 | + 'left' => [ | |
| 432 | + 'title' => __( 'Left', 'betterdocs' ), | |
| 433 | + 'icon' => 'eicon-text-align-left' | |
| 434 | + ], | |
| 435 | + 'center' => [ | |
| 436 | + 'title' => __( 'Center', 'betterdocs' ), | |
| 437 | + 'icon' => 'eicon-text-align-center' | |
| 438 | + ], | |
| 439 | + 'right' => [ | |
| 440 | + 'title' => __( 'Right', 'betterdocs' ), | |
| 441 | + 'icon' => 'eicon-text-align-right' | |
| 442 | + ], | |
| 443 | + 'justify' => [ | |
| 444 | + 'title' => __( 'Justified', 'betterdocs' ), | |
| 445 | + 'icon' => 'eicon-text-align-justify' | |
| 446 | + ] | |
| 447 | + ], | |
| 448 | + 'default' => '', | |
| 449 | + 'selectors' => [ | |
| 450 | + '{{WRAPPER}} .betterdocs-feedback-form .feedback-from-button' => 'text-align: {{VALUE}};' | |
| 451 | + ] | |
| 452 | + ] | |
| 453 | + ); | |
| 454 | + | |
| 455 | + $this->end_controls_section(); | |
| 456 | + } | |
| 457 | + | |
| 458 | + protected function render_callback() { | |
| 459 | + $settings = $this->get_settings_for_display(); | |
| 460 | + | |
| 461 | + betterdocs()->views->get( | |
| 462 | + 'templates/feedback-parts/form', | |
| 463 | + [ | |
| 464 | + 'widget' => $this, | |
| 465 | + 'settings' => $settings | |
| 466 | + ] | |
| 467 | + ); | |
| 468 | + | |
| 469 | + if ( Plugin::instance()->editor->is_edit_mode() ) { | |
| 470 | + $this->render_editor_script(); | |
| 471 | + } | |
| 472 | + } | |
| 473 | + | |
| 474 | + public function render_editor_script() { | |
| 475 | + betterdocs()->views->get( 'templates/feedback-parts/editor' ); | |
| 476 | + } | |
| 433 | 477 | } |