| 1 |
<?php |
| 2 |
|
| 3 |
namespace MasterAddons\Addons; |
| 4 |
|
| 5 |
// Elementor Classes. |
| 6 |
use MasterAddons\Inc\Classes\Base\Master_Widget; |
| 7 |
use \Elementor\Controls_Manager; |
| 8 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 9 |
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 10 |
use \Elementor\Group_Control_Typography; |
| 11 |
use \Elementor\Group_Control_Border; |
| 12 |
use \Elementor\Group_Control_Box_Shadow; |
| 13 |
use \Elementor\Group_Control_Background; |
| 14 |
|
| 15 |
use MasterAddons\Inc\Classes\Helper; |
| 16 |
use MasterAddons\Inc\Admin\Config; |
| 17 |
|
| 18 |
if (!defined('ABSPATH')) { |
| 19 |
exit; // Exit if accessed directly. |
| 20 |
} |
| 21 |
|
| 22 |
class Fluent_Form extends Master_Widget |
| 23 |
{ |
| 24 |
use \MasterAddons\Inc\Traits\Widget_Notice; |
| 25 |
use \MasterAddons\Inc\Traits\Widget_Assets_Trait; |
| 26 |
|
| 27 |
public function get_name() |
| 28 |
{ |
| 29 |
return 'ma-fluent-form'; |
| 30 |
} |
| 31 |
|
| 32 |
public function get_title() |
| 33 |
{ |
| 34 |
return esc_html__('Fluent Form', 'master-addons'); |
| 35 |
} |
| 36 |
|
| 37 |
public function get_icon() |
| 38 |
{ |
| 39 |
return 'jltma-icon ' . Config::get_addon_icon('fluent-form'); |
| 40 |
} |
| 41 |
|
| 42 |
public function get_keywords() |
| 43 |
{ |
| 44 |
return ['fluent', 'form', 'contact', 'styler', 'fluent form', 'wp fluent']; |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
/** |
| 50 |
* Get all forms of WP Fluent Forms plugin. |
| 51 |
*/ |
| 52 |
public static function get_fluent_forms() |
| 53 |
{ |
| 54 |
$forms = array(); |
| 55 |
|
| 56 |
if (function_exists('wpFluentForm')) { |
| 57 |
$ff_list = wpFluent()->table('fluentform_forms') |
| 58 |
->select(array('id', 'title')) |
| 59 |
->orderBy('id', 'DESC') |
| 60 |
->get(); |
| 61 |
|
| 62 |
if ($ff_list) { |
| 63 |
$forms[0] = esc_html__('Select', 'master-addons'); |
| 64 |
foreach ($ff_list as $form) { |
| 65 |
$forms[$form->id] = $form->title . ' (' . absint($form->id) . ')'; |
| 66 |
} |
| 67 |
} else { |
| 68 |
$forms[0] = esc_html__('No Forms Found!', 'master-addons'); |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
return $forms; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Validate HTML tag |
| 77 |
*/ |
| 78 |
public static function jltma_validate_html_tag($tag) |
| 79 |
{ |
| 80 |
$allowed_tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'span', 'p']; |
| 81 |
return in_array($tag, $allowed_tags, true) ? $tag : 'h3'; |
| 82 |
} |
| 83 |
|
| 84 |
protected function register_controls() |
| 85 |
{ |
| 86 |
// content tab. |
| 87 |
$this->register_general_content_controls(); |
| 88 |
$this->register_input_style_controls(); |
| 89 |
$this->register_radio_checkbox_content_controls(); |
| 90 |
$this->register_star_rating_controls(); |
| 91 |
$this->register_section_controls(); |
| 92 |
$this->register_button_content_controls(); |
| 93 |
$this->register_error_style_controls(); |
| 94 |
|
| 95 |
// Style tab. |
| 96 |
$this->register_spacing_controls(); |
| 97 |
$this->register_typography_controls(); |
| 98 |
|
| 99 |
// Upgrade to Pro |
| 100 |
$this->upgrade_to_pro_message(); |
| 101 |
} |
| 102 |
|
| 103 |
/** |
| 104 |
* Register WP Fluent Forms Styler General Controls. |
| 105 |
*/ |
| 106 |
protected function register_general_content_controls() |
| 107 |
{ |
| 108 |
$this->start_controls_section( |
| 109 |
'section_button', |
| 110 |
array( |
| 111 |
'label' => __('General', 'master-addons'), |
| 112 |
) |
| 113 |
); |
| 114 |
|
| 115 |
$this->add_control( |
| 116 |
'form_id', |
| 117 |
array( |
| 118 |
'label' => __('Select Form', 'master-addons'), |
| 119 |
'type' => Controls_Manager::SELECT, |
| 120 |
'options' => $this->get_fluent_forms(), |
| 121 |
'default' => '0', |
| 122 |
) |
| 123 |
); |
| 124 |
|
| 125 |
$this->add_control( |
| 126 |
'form_title_option', |
| 127 |
array( |
| 128 |
'label' => __('Title & Description', 'master-addons'), |
| 129 |
'type' => Controls_Manager::SELECT, |
| 130 |
'default' => 'yes', |
| 131 |
'label_block' => false, |
| 132 |
'options' => array( |
| 133 |
'yes' => __('Enter Your Own', 'master-addons'), |
| 134 |
'no' => __('None', 'master-addons'), |
| 135 |
), |
| 136 |
) |
| 137 |
); |
| 138 |
|
| 139 |
$this->add_control( |
| 140 |
'form_title', |
| 141 |
array( |
| 142 |
'label' => __('Form Title', 'master-addons'), |
| 143 |
'type' => Controls_Manager::TEXT, |
| 144 |
'condition' => array( |
| 145 |
'form_title_option' => 'yes', |
| 146 |
), |
| 147 |
'dynamic' => array( |
| 148 |
'active' => true, |
| 149 |
), |
| 150 |
|
| 151 |
) |
| 152 |
); |
| 153 |
|
| 154 |
$this->add_control( |
| 155 |
'form_desc', |
| 156 |
array( |
| 157 |
'label' => __('Form Description', 'master-addons'), |
| 158 |
'type' => Controls_Manager::TEXTAREA, |
| 159 |
'condition' => array( |
| 160 |
'form_title_option' => 'yes', |
| 161 |
), |
| 162 |
'dynamic' => array( |
| 163 |
'active' => true, |
| 164 |
), |
| 165 |
) |
| 166 |
); |
| 167 |
|
| 168 |
$this->add_responsive_control( |
| 169 |
'form_title_desc_align', |
| 170 |
array( |
| 171 |
'label' => __('Title & Description Alignment', 'master-addons'), |
| 172 |
'type' => Controls_Manager::CHOOSE, |
| 173 |
'options' => Helper::jltma_content_alignment(), |
| 174 |
'default' => 'left', |
| 175 |
'condition' => array( |
| 176 |
'form_title_option' => 'yes', |
| 177 |
), |
| 178 |
'selectors' => array( |
| 179 |
'{{WRAPPER}} .jltma-ff-form-desc, |
| 180 |
{{WRAPPER}} .jltma-ff-form-title' => 'text-align: {{VALUE}};', |
| 181 |
), |
| 182 |
'toggle' => false, |
| 183 |
) |
| 184 |
); |
| 185 |
|
| 186 |
$this->end_controls_section(); |
| 187 |
|
| 188 |
// Help Docs section (links from config.php) |
| 189 |
$this->jltma_help_docs('fluent-form'); |
| 190 |
|
| 191 |
$this->upgrade_to_pro_message(); |
| 192 |
} |
| 193 |
|
| 194 |
/** |
| 195 |
* Register WP Fluent Forms Styler Input Style Controls. |
| 196 |
*/ |
| 197 |
protected function register_input_style_controls() |
| 198 |
{ |
| 199 |
$this->start_controls_section( |
| 200 |
'form_input_style', |
| 201 |
array( |
| 202 |
'label' => __('Form Fields', 'master-addons'), |
| 203 |
) |
| 204 |
); |
| 205 |
|
| 206 |
$this->add_control( |
| 207 |
'ff_style', |
| 208 |
array( |
| 209 |
'label' => __('Style', 'master-addons'), |
| 210 |
'type' => Controls_Manager::SELECT, |
| 211 |
'default' => 'box', |
| 212 |
'options' => array( |
| 213 |
'box' => __('Box', 'master-addons'), |
| 214 |
'underline' => __('Underline', 'master-addons'), |
| 215 |
), |
| 216 |
'prefix_class' => 'jltma-ff-style-', |
| 217 |
) |
| 218 |
); |
| 219 |
|
| 220 |
$this->add_control( |
| 221 |
'form_input_size', |
| 222 |
array( |
| 223 |
'label' => __('Size', 'master-addons'), |
| 224 |
'type' => Controls_Manager::SELECT, |
| 225 |
'default' => 'sm', |
| 226 |
'options' => array( |
| 227 |
'xs' => __('Extra Small', 'master-addons'), |
| 228 |
'sm' => __('Small', 'master-addons'), |
| 229 |
'md' => __('Medium', 'master-addons'), |
| 230 |
'lg' => __('Large', 'master-addons'), |
| 231 |
'xl' => __('Extra Large', 'master-addons'), |
| 232 |
), |
| 233 |
'prefix_class' => 'jltma-ff-input-size-', |
| 234 |
) |
| 235 |
); |
| 236 |
|
| 237 |
$this->add_responsive_control( |
| 238 |
'form_input_padding', |
| 239 |
array( |
| 240 |
'label' => __('Padding', 'master-addons'), |
| 241 |
'type' => Controls_Manager::DIMENSIONS, |
| 242 |
'size_units' => array('px'), |
| 243 |
'selectors' => array( |
| 244 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 245 |
{{WRAPPER}} .jltma-ff-style .fluentform textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 246 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input' => 'height: {{BOTTOM}}{{UNIT}}; width: {{BOTTOM}}{{UNIT}}; font-size: calc( {{BOTTOM}}{{UNIT}} / 1.2 );', |
| 247 |
'{{WRAPPER}} .jltma-ff-style .fluentform select.ff-el-form-control, |
| 248 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'padding-top: calc( {{TOP}}{{UNIT}} - 2{{UNIT}} ); padding-right: {{RIGHT}}{{UNIT}}; padding-bottom: calc( {{BOTTOM}}{{UNIT}} - 2{{UNIT}} ); padding-left: {{LEFT}}{{UNIT}};', |
| 249 |
), |
| 250 |
'separator' => 'after', |
| 251 |
) |
| 252 |
); |
| 253 |
|
| 254 |
$this->add_control( |
| 255 |
'form_input_bgcolor', |
| 256 |
array( |
| 257 |
'label' => __('Background Color', 'master-addons'), |
| 258 |
'type' => Controls_Manager::COLOR, |
| 259 |
'default' => '#fafafa', |
| 260 |
'selectors' => array( |
| 261 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 262 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input, |
| 263 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-net-label, |
| 264 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'background-color:{{VALUE}};', |
| 265 |
), |
| 266 |
) |
| 267 |
); |
| 268 |
|
| 269 |
$this->add_control( |
| 270 |
'form_label_color', |
| 271 |
array( |
| 272 |
'label' => __('Label Color', 'master-addons'), |
| 273 |
'type' => Controls_Manager::COLOR, |
| 274 |
'global' => array( |
| 275 |
'default' => Global_Colors::COLOR_TEXT, |
| 276 |
), |
| 277 |
'default' => '', |
| 278 |
'selectors' => array( |
| 279 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 280 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-input--label label, |
| 281 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input + span, |
| 282 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-section-title, |
| 283 |
{{WRAPPER}} .jltma-ff-style .ff-section_break_desk, |
| 284 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_tc_checkbox + div.ff_t_c' => 'color: {{VALUE}};', |
| 285 |
), |
| 286 |
) |
| 287 |
); |
| 288 |
|
| 289 |
$this->add_control( |
| 290 |
'form_input_color', |
| 291 |
array( |
| 292 |
'label' => __('Input Text / Placeholder Color', 'master-addons'), |
| 293 |
'type' => Controls_Manager::COLOR, |
| 294 |
'global' => array( |
| 295 |
'default' => Global_Colors::COLOR_TEXT, |
| 296 |
), |
| 297 |
'default' => '', |
| 298 |
'selectors' => array( |
| 299 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control::-webkit-input-placeholder, {{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 300 |
{{WRAPPER}} .jltma-ff-style .fluentform input[type=checkbox]:checked:before, |
| 301 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-net-label span, |
| 302 |
{{WRAPPER}} .jltma-ff-style .jltma-ff-select-custom:after' => 'color: {{VALUE}};', |
| 303 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-ratings.jss-ff-el-ratings label.active svg' => 'fill: {{VALUE}};', |
| 304 |
'{{WRAPPER}} .jltma-ff-style .fluentform input[type=radio]:checked:before' => 'background-color: {{VALUE}}; box-shadow:inset 0px 0px 0px 4px {{form_input_bgcolor.VALUE}};', |
| 305 |
), |
| 306 |
) |
| 307 |
); |
| 308 |
|
| 309 |
$this->add_control( |
| 310 |
'form_required_color', |
| 311 |
array( |
| 312 |
'label' => __('Required Asterisk Color', 'master-addons'), |
| 313 |
'type' => Controls_Manager::COLOR, |
| 314 |
'default' => '', |
| 315 |
'selectors' => array( |
| 316 |
'{{WRAPPER}} .jltma-ff-style .ff-el-input--label.ff-el-is-required.asterisk-right label:after' => 'color: {{VALUE}};', |
| 317 |
), |
| 318 |
) |
| 319 |
); |
| 320 |
|
| 321 |
$this->add_control( |
| 322 |
'input_border_style', |
| 323 |
array( |
| 324 |
'label' => __('Border Style', 'master-addons'), |
| 325 |
'type' => Controls_Manager::SELECT, |
| 326 |
'default' => 'solid', |
| 327 |
'label_block' => false, |
| 328 |
'options' => array( |
| 329 |
'none' => __('None', 'master-addons'), |
| 330 |
'solid' => __('Solid', 'master-addons'), |
| 331 |
'double' => __('Double', 'master-addons'), |
| 332 |
'dotted' => __('Dotted', 'master-addons'), |
| 333 |
'dashed' => __('Dashed', 'master-addons'), |
| 334 |
), |
| 335 |
'selectors' => array( |
| 336 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 337 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input, |
| 338 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td, |
| 339 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'border-style: {{VALUE}};', |
| 340 |
), |
| 341 |
'condition' => array( |
| 342 |
'ff_style' => 'box', |
| 343 |
), |
| 344 |
) |
| 345 |
); |
| 346 |
|
| 347 |
$this->add_control( |
| 348 |
'input_border_size', |
| 349 |
array( |
| 350 |
'label' => __('Border Width', 'master-addons'), |
| 351 |
'type' => Controls_Manager::DIMENSIONS, |
| 352 |
'size_units' => array('px'), |
| 353 |
'default' => array( |
| 354 |
'top' => '1', |
| 355 |
'bottom' => '1', |
| 356 |
'left' => '1', |
| 357 |
'right' => '1', |
| 358 |
'unit' => 'px', |
| 359 |
), |
| 360 |
'condition' => array( |
| 361 |
'input_border_style!' => 'none', |
| 362 |
'ff_style' => 'box', |
| 363 |
), |
| 364 |
'selectors' => array( |
| 365 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 366 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input, |
| 367 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td, |
| 368 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 369 |
), |
| 370 |
) |
| 371 |
); |
| 372 |
|
| 373 |
$this->add_control( |
| 374 |
'input_border_color', |
| 375 |
array( |
| 376 |
'label' => __('Border Color', 'master-addons'), |
| 377 |
'type' => Controls_Manager::COLOR, |
| 378 |
'condition' => array( |
| 379 |
'input_border_style!' => 'none', |
| 380 |
'ff_style' => 'box', |
| 381 |
), |
| 382 |
'default' => '#eaeaea', |
| 383 |
'selectors' => array( |
| 384 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 385 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input, |
| 386 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td, |
| 387 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'border-color: {{VALUE}};', |
| 388 |
), |
| 389 |
) |
| 390 |
); |
| 391 |
|
| 392 |
$this->add_responsive_control( |
| 393 |
'ff_border_bottom', |
| 394 |
array( |
| 395 |
'label' => __('Border Size', 'master-addons'), |
| 396 |
'type' => Controls_Manager::SLIDER, |
| 397 |
'size_units' => array('px', 'em', 'rem'), |
| 398 |
'range' => array( |
| 399 |
'px' => array( |
| 400 |
'min' => 1, |
| 401 |
'max' => 20, |
| 402 |
), |
| 403 |
), |
| 404 |
'default' => array( |
| 405 |
'size' => '2', |
| 406 |
'unit' => 'px', |
| 407 |
), |
| 408 |
'condition' => array( |
| 409 |
'ff_style' => 'underline', |
| 410 |
), |
| 411 |
'selectors' => array( |
| 412 |
'{{WRAPPER}}.jltma-ff-style-underline .fluentform .ff-el-form-control, |
| 413 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'border-width: 0 0 {{SIZE}}{{UNIT}} 0; border-style: solid;', |
| 414 |
'{{WRAPPER}}.jltma-ff-style-underline .fluentform .ff-el-form-check-input, |
| 415 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td' => 'border-width: {{SIZE}}{{UNIT}}; border-style: solid; box-sizing: content-box;', |
| 416 |
), |
| 417 |
) |
| 418 |
); |
| 419 |
|
| 420 |
$this->add_control( |
| 421 |
'ff_border_color', |
| 422 |
array( |
| 423 |
'label' => __('Border Color', 'master-addons'), |
| 424 |
'type' => Controls_Manager::COLOR, |
| 425 |
'condition' => array( |
| 426 |
'ff_style' => 'underline', |
| 427 |
), |
| 428 |
'default' => '#c4c4c4', |
| 429 |
'selectors' => array( |
| 430 |
'{{WRAPPER}}.jltma-ff-style-underline .fluentform .ff-el-form-control, |
| 431 |
{{WRAPPER}}.jltma-ff-style-underline .fluentform .ff-el-form-check-input, |
| 432 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td, |
| 433 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'border-color: {{VALUE}};', |
| 434 |
), |
| 435 |
) |
| 436 |
); |
| 437 |
|
| 438 |
$this->add_control( |
| 439 |
'ff_border_active_color', |
| 440 |
array( |
| 441 |
'label' => __('Border Active Color', 'master-addons'), |
| 442 |
'type' => Controls_Manager::COLOR, |
| 443 |
'condition' => array( |
| 444 |
'input_border_style!' => 'none', |
| 445 |
'ff_style' => 'box', |
| 446 |
), |
| 447 |
'selectors' => array( |
| 448 |
'{{WRAPPER}} .jltma-ff-style .fluentform input:focus, |
| 449 |
{{WRAPPER}} .jltma-ff-style .fluentform select:focus, |
| 450 |
{{WRAPPER}} .jltma-ff-style .fluentform textarea:focus, |
| 451 |
{{WRAPPER}} .jltma-ff-style .fluentform input[type=checkbox]:checked:before' => 'border-color: {{VALUE}};', |
| 452 |
), |
| 453 |
) |
| 454 |
); |
| 455 |
|
| 456 |
$this->add_control( |
| 457 |
'ff_border_active_color_underline', |
| 458 |
array( |
| 459 |
'label' => __('Border Active Color', 'master-addons'), |
| 460 |
'type' => Controls_Manager::COLOR, |
| 461 |
'condition' => array( |
| 462 |
'ff_style' => 'underline', |
| 463 |
), |
| 464 |
'selectors' => array( |
| 465 |
'{{WRAPPER}} .jltma-ff-style .fluentform input:focus, |
| 466 |
{{WRAPPER}} .jltma-ff-style .fluentform textarea:focus, |
| 467 |
{{WRAPPER}}.jltma-ff-style-underline .fluentform input[type="checkbox"]:checked' => 'border-color: {{VALUE}};', |
| 468 |
), |
| 469 |
) |
| 470 |
); |
| 471 |
|
| 472 |
$this->add_responsive_control( |
| 473 |
'form_border_radius', |
| 474 |
array( |
| 475 |
'label' => __('Rounded Corners', 'master-addons'), |
| 476 |
'type' => Controls_Manager::DIMENSIONS, |
| 477 |
'size_units' => array('px'), |
| 478 |
'default' => array( |
| 479 |
'top' => '0', |
| 480 |
'bottom' => '0', |
| 481 |
'left' => '0', |
| 482 |
'right' => '0', |
| 483 |
'unit' => 'px', |
| 484 |
), |
| 485 |
'selectors' => array( |
| 486 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-control, |
| 487 |
{{WRAPPER}} .jltma-ff-style .fluentform input[type=checkbox], |
| 488 |
{{WRAPPER}} .jltma-ff-style .fluentform .select2-selection' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 489 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td:first-of-type' => 'border-radius: {{TOP}}{{UNIT}} 0 0 {{LEFT}}{{UNIT}};', |
| 490 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_net_table tbody tr td:last-child' => 'border-radius: 0 {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} 0;', |
| 491 |
), |
| 492 |
) |
| 493 |
); |
| 494 |
|
| 495 |
$this->end_controls_section(); |
| 496 |
} |
| 497 |
|
| 498 |
/** |
| 499 |
* Register WP Fluent Forms Styler Radio & Checkbox Controls. |
| 500 |
*/ |
| 501 |
protected function register_radio_checkbox_content_controls() |
| 502 |
{ |
| 503 |
$this->start_controls_section( |
| 504 |
'ff_radio_check_style', |
| 505 |
array( |
| 506 |
'label' => __('Radio & Checkbox', 'master-addons'), |
| 507 |
) |
| 508 |
); |
| 509 |
|
| 510 |
$this->add_control( |
| 511 |
'ff_radio_check_custom', |
| 512 |
array( |
| 513 |
'label' => __('Override Current Style', 'master-addons'), |
| 514 |
'type' => Controls_Manager::SWITCHER, |
| 515 |
'label_on' => __('Yes', 'master-addons'), |
| 516 |
'label_off' => __('No', 'master-addons'), |
| 517 |
'return_value' => 'yes', |
| 518 |
'default' => '', |
| 519 |
'prefix_class' => 'jltma-ff-check-', |
| 520 |
) |
| 521 |
); |
| 522 |
|
| 523 |
$this->add_control( |
| 524 |
'ff_radio_check_size', |
| 525 |
array( |
| 526 |
'label' => __('Size', 'master-addons'), |
| 527 |
'type' => Controls_Manager::SLIDER, |
| 528 |
'size_units' => array('px', 'em', 'rem'), |
| 529 |
'condition' => array( |
| 530 |
'ff_radio_check_custom!' => '', |
| 531 |
), |
| 532 |
'default' => array( |
| 533 |
'unit' => 'px', |
| 534 |
'size' => 20, |
| 535 |
), |
| 536 |
'range' => array( |
| 537 |
'px' => array( |
| 538 |
'min' => 15, |
| 539 |
'max' => 50, |
| 540 |
), |
| 541 |
), |
| 542 |
'selectors' => array( |
| 543 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input' => 'width: {{SIZE}}{{UNIT}}!important; height:{{SIZE}}{{UNIT}}; font-size: calc( {{SIZE}}{{UNIT}} / 1.2 );', |
| 544 |
), |
| 545 |
'separator' => 'after', |
| 546 |
) |
| 547 |
); |
| 548 |
|
| 549 |
$this->add_control( |
| 550 |
'ff_radio_check_bgcolor', |
| 551 |
array( |
| 552 |
'label' => __('Background Color', 'master-addons'), |
| 553 |
'type' => Controls_Manager::COLOR, |
| 554 |
'condition' => array( |
| 555 |
'ff_radio_check_custom!' => '', |
| 556 |
), |
| 557 |
'selectors' => array( |
| 558 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input' => 'background-color: {{VALUE}};', |
| 559 |
), |
| 560 |
'default' => '#fafafa', |
| 561 |
) |
| 562 |
); |
| 563 |
|
| 564 |
$this->add_control( |
| 565 |
'ff_selected_color', |
| 566 |
array( |
| 567 |
'label' => __('Selected Color', 'master-addons'), |
| 568 |
'type' => Controls_Manager::COLOR, |
| 569 |
'global' => array( |
| 570 |
'default' => Global_Colors::COLOR_TEXT, |
| 571 |
), |
| 572 |
'condition' => array( |
| 573 |
'ff_radio_check_custom!' => '', |
| 574 |
), |
| 575 |
'selectors' => array( |
| 576 |
'{{WRAPPER}}.jltma-ff-check-yes .jltma-ff-style .fluentform input[type=checkbox]:checked:before' => 'color: {{VALUE}};', |
| 577 |
'{{WRAPPER}}.jltma-ff-check-yes .jltma-ff-style .fluentform input[type=radio]:checked:before' => 'background-color: {{VALUE}}; box-shadow:inset 0px 0px 0px 4px {{ff_radio_check_bgcolor.VALUE}};', |
| 578 |
), |
| 579 |
) |
| 580 |
); |
| 581 |
|
| 582 |
$this->add_control( |
| 583 |
'ff_select_color', |
| 584 |
array( |
| 585 |
'label' => __('Label Color', 'master-addons'), |
| 586 |
'type' => Controls_Manager::COLOR, |
| 587 |
'default' => '', |
| 588 |
'condition' => array( |
| 589 |
'ff_radio_check_custom!' => '', |
| 590 |
), |
| 591 |
'selectors' => array( |
| 592 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input + span, |
| 593 |
{{WRAPPER}}.jltma-ff-check-yes .jltma-ff-style .fluentform .ff_tc_checkbox + div.ff_t_c' => 'color: {{VALUE}};', |
| 594 |
), |
| 595 |
) |
| 596 |
); |
| 597 |
|
| 598 |
$this->add_control( |
| 599 |
'ff_check_border_color', |
| 600 |
array( |
| 601 |
'label' => __('Border Color', 'master-addons'), |
| 602 |
'type' => Controls_Manager::COLOR, |
| 603 |
'default' => '#eaeaea', |
| 604 |
'condition' => array( |
| 605 |
'ff_radio_check_custom!' => '', |
| 606 |
), |
| 607 |
'selectors' => array( |
| 608 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input' => 'border-color: {{VALUE}};', |
| 609 |
), |
| 610 |
) |
| 611 |
); |
| 612 |
|
| 613 |
$this->add_control( |
| 614 |
'ff_check_border_width', |
| 615 |
array( |
| 616 |
'label' => __('Border Width', 'master-addons'), |
| 617 |
'type' => Controls_Manager::SLIDER, |
| 618 |
'size_units' => array('px'), |
| 619 |
'range' => array( |
| 620 |
'px' => array( |
| 621 |
'min' => 0, |
| 622 |
'max' => 20, |
| 623 |
), |
| 624 |
), |
| 625 |
'default' => array( |
| 626 |
'size' => '1', |
| 627 |
'unit' => 'px', |
| 628 |
), |
| 629 |
'condition' => array( |
| 630 |
'ff_radio_check_custom!' => '', |
| 631 |
), |
| 632 |
'selectors' => array( |
| 633 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input' => 'border-width: {{SIZE}}{{UNIT}}; border-style: solid;', |
| 634 |
), |
| 635 |
) |
| 636 |
); |
| 637 |
|
| 638 |
$this->add_control( |
| 639 |
'ff_check_border_radius', |
| 640 |
array( |
| 641 |
'label' => __('Checkbox Rounded Corners', 'master-addons'), |
| 642 |
'type' => Controls_Manager::DIMENSIONS, |
| 643 |
'size_units' => array('px', '%'), |
| 644 |
'condition' => array( |
| 645 |
'ff_radio_check_custom!' => '', |
| 646 |
), |
| 647 |
'selectors' => array( |
| 648 |
'{{WRAPPER}}.jltma-ff-check-yes .jltma-ff-style .fluentform input[type=checkbox]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 649 |
), |
| 650 |
'default' => array( |
| 651 |
'top' => '0', |
| 652 |
'bottom' => '0', |
| 653 |
'left' => '0', |
| 654 |
'right' => '0', |
| 655 |
'unit' => 'px', |
| 656 |
), |
| 657 |
) |
| 658 |
); |
| 659 |
|
| 660 |
$this->end_controls_section(); |
| 661 |
} |
| 662 |
|
| 663 |
/** |
| 664 |
* Register WP Fluent Forms Styler Button Controls. |
| 665 |
*/ |
| 666 |
protected function register_button_content_controls() |
| 667 |
{ |
| 668 |
$this->start_controls_section( |
| 669 |
'section_style', |
| 670 |
array( |
| 671 |
'label' => __('Button', 'master-addons'), |
| 672 |
) |
| 673 |
); |
| 674 |
|
| 675 |
$this->add_control( |
| 676 |
'ff_buttons', |
| 677 |
array( |
| 678 |
'label' => __('Submit And Navigation Button', 'master-addons'), |
| 679 |
'type' => Controls_Manager::HEADING, |
| 680 |
) |
| 681 |
); |
| 682 |
|
| 683 |
$this->add_responsive_control( |
| 684 |
'button_align', |
| 685 |
array( |
| 686 |
'label' => __('Submit Button Alignment', 'master-addons'), |
| 687 |
'type' => Controls_Manager::CHOOSE, |
| 688 |
'options' => Helper::jltma_content_alignment(), |
| 689 |
'default' => 'left', |
| 690 |
'condition' => array( |
| 691 |
'form_title_option' => 'yes', |
| 692 |
), |
| 693 |
'prefix_class' => 'jltma-ff-button-align-', |
| 694 |
'selectors' => array( |
| 695 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper' => 'text-align: {{VALUE}};', |
| 696 |
), |
| 697 |
'toggle' => false, |
| 698 |
) |
| 699 |
); |
| 700 |
|
| 701 |
$this->add_control( |
| 702 |
'btn_size', |
| 703 |
array( |
| 704 |
'label' => __('Size', 'master-addons'), |
| 705 |
'type' => Controls_Manager::SELECT, |
| 706 |
'default' => 'sm', |
| 707 |
'options' => array( |
| 708 |
'xs' => __('Extra Small', 'master-addons'), |
| 709 |
'sm' => __('Small', 'master-addons'), |
| 710 |
'md' => __('Medium', 'master-addons'), |
| 711 |
'lg' => __('Large', 'master-addons'), |
| 712 |
'xl' => __('Extra Large', 'master-addons'), |
| 713 |
), |
| 714 |
'prefix_class' => 'jltma-ff-btn-size-', |
| 715 |
) |
| 716 |
); |
| 717 |
|
| 718 |
$this->add_responsive_control( |
| 719 |
'ff_button_padding', |
| 720 |
array( |
| 721 |
'label' => __('Padding', 'master-addons'), |
| 722 |
'type' => Controls_Manager::DIMENSIONS, |
| 723 |
'size_units' => array('px', 'em', '%'), |
| 724 |
'selectors' => array( |
| 725 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit, |
| 726 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 727 |
), |
| 728 |
) |
| 729 |
); |
| 730 |
|
| 731 |
$this->start_controls_tabs('tabs_button_style'); |
| 732 |
|
| 733 |
$this->start_controls_tab( |
| 734 |
'tab_button_normal', |
| 735 |
array( |
| 736 |
'label' => __('Normal', 'master-addons'), |
| 737 |
) |
| 738 |
); |
| 739 |
|
| 740 |
$this->add_control( |
| 741 |
'button_text_color', |
| 742 |
array( |
| 743 |
'label' => __('Text Color', 'master-addons'), |
| 744 |
'type' => Controls_Manager::COLOR, |
| 745 |
'default' => '', |
| 746 |
'selectors' => array( |
| 747 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit, |
| 748 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary' => 'color: {{VALUE}};', |
| 749 |
), |
| 750 |
) |
| 751 |
); |
| 752 |
|
| 753 |
$this->add_group_control( |
| 754 |
Group_Control_Background::get_type(), |
| 755 |
array( |
| 756 |
'name' => 'btn_background_color', |
| 757 |
'label' => __('Background Color', 'master-addons'), |
| 758 |
'types' => array('classic', 'gradient'), |
| 759 |
'fields_options' => array( |
| 760 |
'color' => array( |
| 761 |
'global' => array( |
| 762 |
'default' => Global_Colors::COLOR_ACCENT, |
| 763 |
), |
| 764 |
), |
| 765 |
), |
| 766 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit, |
| 767 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary', |
| 768 |
) |
| 769 |
); |
| 770 |
|
| 771 |
$this->add_group_control( |
| 772 |
Group_Control_Border::get_type(), |
| 773 |
array( |
| 774 |
'name' => 'btn_border', |
| 775 |
'label' => __('Border', 'master-addons'), |
| 776 |
'placeholder' => '1px', |
| 777 |
'default' => '1px', |
| 778 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit, |
| 779 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary', |
| 780 |
) |
| 781 |
); |
| 782 |
|
| 783 |
$this->add_responsive_control( |
| 784 |
'btn_border_radius', |
| 785 |
array( |
| 786 |
'label' => __('Border Radius', 'master-addons'), |
| 787 |
'type' => Controls_Manager::DIMENSIONS, |
| 788 |
'size_units' => array('px', '%'), |
| 789 |
'selectors' => array( |
| 790 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit, |
| 791 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 792 |
), |
| 793 |
) |
| 794 |
); |
| 795 |
|
| 796 |
$this->add_group_control( |
| 797 |
Group_Control_Box_Shadow::get_type(), |
| 798 |
array( |
| 799 |
'name' => 'button_box_shadow', |
| 800 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit, |
| 801 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary', |
| 802 |
) |
| 803 |
); |
| 804 |
|
| 805 |
$this->end_controls_tab(); |
| 806 |
|
| 807 |
$this->start_controls_tab( |
| 808 |
'tab_button_hover', |
| 809 |
array( |
| 810 |
'label' => __('Hover', 'master-addons'), |
| 811 |
) |
| 812 |
); |
| 813 |
|
| 814 |
$this->add_control( |
| 815 |
'btn_hover_color', |
| 816 |
array( |
| 817 |
'label' => __('Text Color', 'master-addons'), |
| 818 |
'type' => Controls_Manager::COLOR, |
| 819 |
'selectors' => array( |
| 820 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit:hover, |
| 821 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary:hover' => 'color: {{VALUE}};', |
| 822 |
), |
| 823 |
) |
| 824 |
); |
| 825 |
|
| 826 |
$this->add_control( |
| 827 |
'ff_button_hover_border_color', |
| 828 |
array( |
| 829 |
'label' => __('Border Hover Color', 'master-addons'), |
| 830 |
'type' => Controls_Manager::COLOR, |
| 831 |
'selectors' => array( |
| 832 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit:hover, |
| 833 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary:hover' => 'border-color: {{VALUE}};', |
| 834 |
), |
| 835 |
) |
| 836 |
); |
| 837 |
|
| 838 |
$this->add_group_control( |
| 839 |
Group_Control_Background::get_type(), |
| 840 |
array( |
| 841 |
'name' => 'button_background_hover_color', |
| 842 |
'label' => __('Background Color', 'master-addons'), |
| 843 |
'types' => array('classic', 'gradient'), |
| 844 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff_submit_btn_wrapper button.ff-btn-submit:hover, |
| 845 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary:hover', |
| 846 |
) |
| 847 |
); |
| 848 |
|
| 849 |
$this->end_controls_tab(); |
| 850 |
|
| 851 |
$this->end_controls_tabs(); |
| 852 |
|
| 853 |
$this->end_controls_section(); |
| 854 |
} |
| 855 |
|
| 856 |
/** |
| 857 |
* Register WP Fluent Forms Styler Error Style Controls. |
| 858 |
*/ |
| 859 |
protected function register_error_style_controls() |
| 860 |
{ |
| 861 |
$this->start_controls_section( |
| 862 |
'form_error_field', |
| 863 |
array( |
| 864 |
'label' => __('Success / Error Message', 'master-addons'), |
| 865 |
) |
| 866 |
); |
| 867 |
|
| 868 |
$this->add_control( |
| 869 |
'form_error', |
| 870 |
array( |
| 871 |
'label' => __('Field Validation', 'master-addons'), |
| 872 |
'type' => Controls_Manager::HEADING, |
| 873 |
) |
| 874 |
); |
| 875 |
|
| 876 |
$this->add_group_control( |
| 877 |
Group_Control_Typography::get_type(), |
| 878 |
array( |
| 879 |
'name' => 'ff_message_typo', |
| 880 |
'global' => array( |
| 881 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 882 |
), |
| 883 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-is-error .error', |
| 884 |
) |
| 885 |
); |
| 886 |
|
| 887 |
$this->add_control( |
| 888 |
'form_error_msg_color', |
| 889 |
array( |
| 890 |
'label' => __('Message Color', 'master-addons'), |
| 891 |
'type' => Controls_Manager::COLOR, |
| 892 |
'default' => '#ff0000', |
| 893 |
'selectors' => array( |
| 894 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-is-error .error' => 'color: {{VALUE}}', |
| 895 |
), |
| 896 |
) |
| 897 |
); |
| 898 |
|
| 899 |
$this->add_responsive_control( |
| 900 |
'field_validation_padding', |
| 901 |
array( |
| 902 |
'label' => __('Padding', 'master-addons'), |
| 903 |
'type' => Controls_Manager::DIMENSIONS, |
| 904 |
'size_units' => array('px', 'em', '%'), |
| 905 |
'selectors' => array( |
| 906 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-is-error .error' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 907 |
), |
| 908 |
) |
| 909 |
); |
| 910 |
|
| 911 |
$this->add_control( |
| 912 |
'form_success_message', |
| 913 |
array( |
| 914 |
'label' => __('Form Success Validation', 'master-addons'), |
| 915 |
'type' => Controls_Manager::HEADING, |
| 916 |
'separator' => 'before', |
| 917 |
) |
| 918 |
); |
| 919 |
|
| 920 |
$this->add_responsive_control( |
| 921 |
'success_align', |
| 922 |
array( |
| 923 |
'label' => __('Alignment', 'master-addons'), |
| 924 |
'type' => Controls_Manager::CHOOSE, |
| 925 |
'options' => Helper::jltma_content_alignment(), |
| 926 |
'default' => 'left', |
| 927 |
'selectors' => array( |
| 928 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-message-success' => 'text-align: {{VALUE}};', |
| 929 |
), |
| 930 |
'toggle' => false, |
| 931 |
'prefix_class' => 'jltma-ff-message-align-', |
| 932 |
) |
| 933 |
); |
| 934 |
|
| 935 |
$this->add_group_control( |
| 936 |
Group_Control_Typography::get_type(), |
| 937 |
array( |
| 938 |
'name' => 'cf7_success_validation_typo', |
| 939 |
'global' => array( |
| 940 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 941 |
), |
| 942 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff-message-success', |
| 943 |
) |
| 944 |
); |
| 945 |
|
| 946 |
$this->add_control( |
| 947 |
'form_success_message_color', |
| 948 |
array( |
| 949 |
'label' => __('Message Color', 'master-addons'), |
| 950 |
'type' => Controls_Manager::COLOR, |
| 951 |
'default' => '#008000', |
| 952 |
'selectors' => array( |
| 953 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-message-success' => 'color: {{VALUE}};', |
| 954 |
), |
| 955 |
) |
| 956 |
); |
| 957 |
|
| 958 |
$this->add_control( |
| 959 |
'form_valid_bgcolor', |
| 960 |
array( |
| 961 |
'label' => __('Message Background Color', 'master-addons'), |
| 962 |
'type' => Controls_Manager::COLOR, |
| 963 |
'default' => '', |
| 964 |
'selectors' => array( |
| 965 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-message-success' => 'background-color: {{VALUE}};', |
| 966 |
), |
| 967 |
) |
| 968 |
); |
| 969 |
|
| 970 |
$this->end_controls_section(); |
| 971 |
} |
| 972 |
|
| 973 |
/** |
| 974 |
* Register WP Fluent Forms Styler Star Rating Controls. |
| 975 |
*/ |
| 976 |
protected function register_star_rating_controls() |
| 977 |
{ |
| 978 |
$this->start_controls_section( |
| 979 |
'star_rating_field', |
| 980 |
array( |
| 981 |
'label' => __('Star Rating', 'master-addons'), |
| 982 |
) |
| 983 |
); |
| 984 |
|
| 985 |
$this->add_control( |
| 986 |
'ff_star_rating_custom', |
| 987 |
array( |
| 988 |
'label' => __('Override Current Style', 'master-addons'), |
| 989 |
'type' => Controls_Manager::SWITCHER, |
| 990 |
'label_on' => __('Yes', 'master-addons'), |
| 991 |
'label_off' => __('No', 'master-addons'), |
| 992 |
'return_value' => 'yes', |
| 993 |
'default' => '', |
| 994 |
'prefix_class' => 'jltma-ff-star-', |
| 995 |
) |
| 996 |
); |
| 997 |
|
| 998 |
$this->add_responsive_control( |
| 999 |
'ff_star_rating_size', |
| 1000 |
array( |
| 1001 |
'label' => __('Size', 'master-addons'), |
| 1002 |
'type' => Controls_Manager::SLIDER, |
| 1003 |
'size_units' => array('px', 'em', 'rem'), |
| 1004 |
'range' => array( |
| 1005 |
'px' => array( |
| 1006 |
'min' => 0, |
| 1007 |
'max' => 200, |
| 1008 |
), |
| 1009 |
), |
| 1010 |
'condition' => array( |
| 1011 |
'ff_star_rating_custom' => 'yes', |
| 1012 |
), |
| 1013 |
'selectors' => array( |
| 1014 |
'{{WRAPPER}}.jltma-ff-star-yes .jltma-ff-style .fluentform .ff-el-ratings.jss-ff-el-ratings svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 1015 |
), |
| 1016 |
'separator' => 'after', |
| 1017 |
) |
| 1018 |
); |
| 1019 |
|
| 1020 |
$this->add_control( |
| 1021 |
'active_stars_color', |
| 1022 |
array( |
| 1023 |
'label' => __('Selected Color', 'master-addons'), |
| 1024 |
'type' => Controls_Manager::COLOR, |
| 1025 |
'default' => '', |
| 1026 |
'selectors' => array( |
| 1027 |
'{{WRAPPER}}.jltma-ff-star-yes .jltma-ff-style .fluentform .ff-el-ratings.jss-ff-el-ratings label.active svg' => 'fill: {{VALUE}};', |
| 1028 |
), |
| 1029 |
'condition' => array( |
| 1030 |
'ff_star_rating_custom' => 'yes', |
| 1031 |
), |
| 1032 |
) |
| 1033 |
); |
| 1034 |
|
| 1035 |
$this->add_control( |
| 1036 |
'inactive_stars_color', |
| 1037 |
array( |
| 1038 |
'label' => __('Inactive Stars Color', 'master-addons'), |
| 1039 |
'type' => Controls_Manager::COLOR, |
| 1040 |
'default' => '', |
| 1041 |
'selectors' => array( |
| 1042 |
'{{WRAPPER}}.jltma-ff-star-yes .jltma-ff-style .fluentform .ff-el-ratings.jss-ff-el-ratings svg' => 'fill: {{VALUE}};', |
| 1043 |
), |
| 1044 |
'condition' => array( |
| 1045 |
'ff_star_rating_custom' => 'yes', |
| 1046 |
), |
| 1047 |
) |
| 1048 |
); |
| 1049 |
|
| 1050 |
$this->end_controls_section(); |
| 1051 |
} |
| 1052 |
|
| 1053 |
/** |
| 1054 |
* Register WP Fluent Forms Styler Section Break Controls. |
| 1055 |
*/ |
| 1056 |
protected function register_section_controls() |
| 1057 |
{ |
| 1058 |
$this->start_controls_section( |
| 1059 |
'section_field', |
| 1060 |
array( |
| 1061 |
'label' => __('Section Break', 'master-addons'), |
| 1062 |
) |
| 1063 |
); |
| 1064 |
|
| 1065 |
$this->add_control( |
| 1066 |
'form_section_title_style', |
| 1067 |
array( |
| 1068 |
'label' => __('Title', 'master-addons'), |
| 1069 |
'type' => Controls_Manager::HEADING, |
| 1070 |
) |
| 1071 |
); |
| 1072 |
|
| 1073 |
$this->add_group_control( |
| 1074 |
Group_Control_Typography::get_type(), |
| 1075 |
array( |
| 1076 |
'name' => 'section_title_typography', |
| 1077 |
'global' => array( |
| 1078 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1079 |
), |
| 1080 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-section-title', |
| 1081 |
) |
| 1082 |
); |
| 1083 |
|
| 1084 |
$this->add_control( |
| 1085 |
'form_section_title_color', |
| 1086 |
array( |
| 1087 |
'label' => __('Color', 'master-addons'), |
| 1088 |
'type' => Controls_Manager::COLOR, |
| 1089 |
'global' => array( |
| 1090 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 1091 |
), |
| 1092 |
'default' => '', |
| 1093 |
'selectors' => array( |
| 1094 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-section-title' => 'color: {{VALUE}};', |
| 1095 |
), |
| 1096 |
) |
| 1097 |
); |
| 1098 |
|
| 1099 |
$this->add_control( |
| 1100 |
'form_section_desc_style', |
| 1101 |
array( |
| 1102 |
'label' => __('Description', 'master-addons'), |
| 1103 |
'type' => Controls_Manager::HEADING, |
| 1104 |
'separator' => 'before', |
| 1105 |
) |
| 1106 |
); |
| 1107 |
|
| 1108 |
$this->add_group_control( |
| 1109 |
Group_Control_Typography::get_type(), |
| 1110 |
array( |
| 1111 |
'name' => 'section_desc_typography', |
| 1112 |
'global' => array( |
| 1113 |
'default' => Global_Typography::TYPOGRAPHY_SECONDARY, |
| 1114 |
), |
| 1115 |
'selector' => '{{WRAPPER}} .jltma-ff-style .ff-section_break_desk', |
| 1116 |
) |
| 1117 |
); |
| 1118 |
|
| 1119 |
$this->add_control( |
| 1120 |
'form_section_desc_color', |
| 1121 |
array( |
| 1122 |
'label' => __('Color', 'master-addons'), |
| 1123 |
'type' => Controls_Manager::COLOR, |
| 1124 |
'global' => array( |
| 1125 |
'default' => Global_Colors::COLOR_SECONDARY, |
| 1126 |
), |
| 1127 |
'default' => '', |
| 1128 |
'selectors' => array( |
| 1129 |
'{{WRAPPER}} .jltma-ff-style .ff-section_break_desk' => 'color: {{VALUE}};', |
| 1130 |
), |
| 1131 |
) |
| 1132 |
); |
| 1133 |
|
| 1134 |
$this->end_controls_section(); |
| 1135 |
} |
| 1136 |
|
| 1137 |
/** |
| 1138 |
* Register WP Fluent Forms Styler Spacing Controls. |
| 1139 |
*/ |
| 1140 |
protected function register_spacing_controls() |
| 1141 |
{ |
| 1142 |
$this->start_controls_section( |
| 1143 |
'form_spacing', |
| 1144 |
array( |
| 1145 |
'label' => __('Spacing', 'master-addons'), |
| 1146 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1147 |
) |
| 1148 |
); |
| 1149 |
|
| 1150 |
$this->add_responsive_control( |
| 1151 |
'form_title_margin_bottom', |
| 1152 |
array( |
| 1153 |
'label' => __('Form Title Bottom Margin', 'master-addons'), |
| 1154 |
'type' => Controls_Manager::SLIDER, |
| 1155 |
'size_units' => array('px', 'em', 'rem'), |
| 1156 |
'range' => array( |
| 1157 |
'px' => array( |
| 1158 |
'min' => 0, |
| 1159 |
'max' => 200, |
| 1160 |
), |
| 1161 |
), |
| 1162 |
'condition' => array( |
| 1163 |
'form_title_option!' => 'no', |
| 1164 |
), |
| 1165 |
'selectors' => array( |
| 1166 |
'{{WRAPPER}} .jltma-ff-form-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1167 |
), |
| 1168 |
) |
| 1169 |
); |
| 1170 |
|
| 1171 |
$this->add_responsive_control( |
| 1172 |
'form_desc_margin_bottom', |
| 1173 |
array( |
| 1174 |
'label' => __('Form Description Bottom Margin', 'master-addons'), |
| 1175 |
'type' => Controls_Manager::SLIDER, |
| 1176 |
'size_units' => array('px', 'em', 'rem'), |
| 1177 |
'range' => array( |
| 1178 |
'px' => array( |
| 1179 |
'min' => 0, |
| 1180 |
'max' => 200, |
| 1181 |
), |
| 1182 |
), |
| 1183 |
'selectors' => array( |
| 1184 |
'{{WRAPPER}} .jltma-ff-form-desc' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1185 |
), |
| 1186 |
'condition' => array( |
| 1187 |
'form_title_option!' => 'no', |
| 1188 |
), |
| 1189 |
) |
| 1190 |
); |
| 1191 |
|
| 1192 |
$this->add_responsive_control( |
| 1193 |
'form_fields_margin', |
| 1194 |
array( |
| 1195 |
'label' => __('Between Two Fields', 'master-addons'), |
| 1196 |
'type' => Controls_Manager::SLIDER, |
| 1197 |
'size_units' => array('px', 'em', 'rem'), |
| 1198 |
'range' => array( |
| 1199 |
'px' => array( |
| 1200 |
'min' => 0, |
| 1201 |
'max' => 200, |
| 1202 |
), |
| 1203 |
), |
| 1204 |
'selectors' => array( |
| 1205 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-input--content' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 1206 |
), |
| 1207 |
) |
| 1208 |
); |
| 1209 |
|
| 1210 |
$this->add_responsive_control( |
| 1211 |
'form_label_margin_bottom', |
| 1212 |
array( |
| 1213 |
'label' => __('Label Bottom Spacing', 'master-addons'), |
| 1214 |
'type' => Controls_Manager::SLIDER, |
| 1215 |
'size_units' => array('px', 'em', 'rem'), |
| 1216 |
'range' => array( |
| 1217 |
'px' => array( |
| 1218 |
'min' => 0, |
| 1219 |
'max' => 200, |
| 1220 |
), |
| 1221 |
), |
| 1222 |
'selectors' => array( |
| 1223 |
'{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-input--label' => 'margin-bottom: {{SIZE}}{{UNIT}} !important;', |
| 1224 |
), |
| 1225 |
) |
| 1226 |
); |
| 1227 |
|
| 1228 |
$this->end_controls_section(); |
| 1229 |
} |
| 1230 |
|
| 1231 |
/** |
| 1232 |
* Register WP Fluent Forms Styler Typography Controls. |
| 1233 |
*/ |
| 1234 |
protected function register_typography_controls() |
| 1235 |
{ |
| 1236 |
$this->start_controls_section( |
| 1237 |
'form_typo', |
| 1238 |
array( |
| 1239 |
'label' => __('Typography', 'master-addons'), |
| 1240 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1241 |
) |
| 1242 |
); |
| 1243 |
|
| 1244 |
$this->add_control( |
| 1245 |
'form_title_typo', |
| 1246 |
array( |
| 1247 |
'label' => __('Form Title', 'master-addons'), |
| 1248 |
'type' => Controls_Manager::HEADING, |
| 1249 |
'condition' => array( |
| 1250 |
'form_title_option!' => 'no', |
| 1251 |
), |
| 1252 |
) |
| 1253 |
); |
| 1254 |
|
| 1255 |
$this->add_control( |
| 1256 |
'form_title_tag', |
| 1257 |
array( |
| 1258 |
'label' => __('HTML Tag', 'master-addons'), |
| 1259 |
'type' => Controls_Manager::SELECT, |
| 1260 |
'options' => array( |
| 1261 |
'h1' => __('H1', 'master-addons'), |
| 1262 |
'h2' => __('H2', 'master-addons'), |
| 1263 |
'h3' => __('H3', 'master-addons'), |
| 1264 |
'h4' => __('H4', 'master-addons'), |
| 1265 |
'h5' => __('H5', 'master-addons'), |
| 1266 |
'h6' => __('H6', 'master-addons'), |
| 1267 |
'div' => __('div', 'master-addons'), |
| 1268 |
'p' => __('p', 'master-addons'), |
| 1269 |
), |
| 1270 |
'condition' => array( |
| 1271 |
'form_title_option!' => 'no', |
| 1272 |
), |
| 1273 |
'default' => 'h3', |
| 1274 |
) |
| 1275 |
); |
| 1276 |
|
| 1277 |
$this->add_group_control( |
| 1278 |
Group_Control_Typography::get_type(), |
| 1279 |
array( |
| 1280 |
'name' => 'title_typography', |
| 1281 |
'global' => array( |
| 1282 |
'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 1283 |
), |
| 1284 |
'selector' => '{{WRAPPER}} .jltma-ff-form-title', |
| 1285 |
'condition' => array( |
| 1286 |
'form_title_option!' => 'no', |
| 1287 |
), |
| 1288 |
) |
| 1289 |
); |
| 1290 |
|
| 1291 |
$this->add_control( |
| 1292 |
'form_title_color', |
| 1293 |
array( |
| 1294 |
'label' => __('Color', 'master-addons'), |
| 1295 |
'type' => Controls_Manager::COLOR, |
| 1296 |
'global' => array( |
| 1297 |
'default' => Global_Colors::COLOR_PRIMARY, |
| 1298 |
), |
| 1299 |
'condition' => array( |
| 1300 |
'form_title_option!' => 'no', |
| 1301 |
), |
| 1302 |
'default' => '', |
| 1303 |
'selectors' => array( |
| 1304 |
'{{WRAPPER}} .jltma-ff-form-title' => 'color: {{VALUE}};', |
| 1305 |
), |
| 1306 |
) |
| 1307 |
); |
| 1308 |
|
| 1309 |
$this->add_control( |
| 1310 |
'form_desc_typo', |
| 1311 |
array( |
| 1312 |
'label' => __('Form Description', 'master-addons'), |
| 1313 |
'type' => Controls_Manager::HEADING, |
| 1314 |
'separator' => 'before', |
| 1315 |
'condition' => array( |
| 1316 |
'form_title_option!' => 'no', |
| 1317 |
), |
| 1318 |
) |
| 1319 |
); |
| 1320 |
|
| 1321 |
$this->add_group_control( |
| 1322 |
Group_Control_Typography::get_type(), |
| 1323 |
array( |
| 1324 |
'name' => 'desc_typography', |
| 1325 |
'global' => array( |
| 1326 |
'default' => Global_Typography::TYPOGRAPHY_SECONDARY, |
| 1327 |
), |
| 1328 |
'selector' => '{{WRAPPER}} .jltma-ff-form-desc', |
| 1329 |
'condition' => array( |
| 1330 |
'form_title_option!' => 'no', |
| 1331 |
), |
| 1332 |
) |
| 1333 |
); |
| 1334 |
|
| 1335 |
$this->add_control( |
| 1336 |
'form_desc_color', |
| 1337 |
array( |
| 1338 |
'label' => __('Color', 'master-addons'), |
| 1339 |
'type' => Controls_Manager::COLOR, |
| 1340 |
'global' => array( |
| 1341 |
'default' => Global_Colors::COLOR_TEXT, |
| 1342 |
), |
| 1343 |
'condition' => array( |
| 1344 |
'form_title_option!' => 'no', |
| 1345 |
), |
| 1346 |
'default' => '', |
| 1347 |
'separator' => 'after', |
| 1348 |
'selectors' => array( |
| 1349 |
'{{WRAPPER}} .jltma-ff-form-desc' => 'color: {{VALUE}};', |
| 1350 |
), |
| 1351 |
) |
| 1352 |
); |
| 1353 |
|
| 1354 |
$this->add_control( |
| 1355 |
'form_input_typo', |
| 1356 |
array( |
| 1357 |
'label' => __('Form Fields', 'master-addons'), |
| 1358 |
'type' => Controls_Manager::HEADING, |
| 1359 |
) |
| 1360 |
); |
| 1361 |
|
| 1362 |
$this->add_group_control( |
| 1363 |
Group_Control_Typography::get_type(), |
| 1364 |
array( |
| 1365 |
'name' => 'form_label_typography', |
| 1366 |
'label' => 'Label Typography', |
| 1367 |
'global' => array( |
| 1368 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1369 |
), |
| 1370 |
'selector' => '{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-input--label label, |
| 1371 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff-el-form-check-input + span', |
| 1372 |
) |
| 1373 |
); |
| 1374 |
|
| 1375 |
$this->add_group_control( |
| 1376 |
Group_Control_Typography::get_type(), |
| 1377 |
array( |
| 1378 |
'name' => 'input_typography', |
| 1379 |
'label' => 'Text Typography', |
| 1380 |
'global' => array( |
| 1381 |
'default' => Global_Typography::TYPOGRAPHY_TEXT, |
| 1382 |
), |
| 1383 |
'selector' => '{{WRAPPER}} .jltma-ff-style .ff-el-input--content input:not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="file"]), |
| 1384 |
{{WRAPPER}} .jltma-ff-style .ff-el-input--content textarea, |
| 1385 |
{{WRAPPER}} .jltma-ff-style .fluentform select, |
| 1386 |
{{WRAPPER}} .jltma-ff-style .jltma-ff-select-custom', |
| 1387 |
) |
| 1388 |
); |
| 1389 |
|
| 1390 |
$this->add_control( |
| 1391 |
'btn_typography_label', |
| 1392 |
array( |
| 1393 |
'label' => __('Button', 'master-addons'), |
| 1394 |
'type' => Controls_Manager::HEADING, |
| 1395 |
'separator' => 'before', |
| 1396 |
) |
| 1397 |
); |
| 1398 |
|
| 1399 |
$this->add_group_control( |
| 1400 |
Group_Control_Typography::get_type(), |
| 1401 |
array( |
| 1402 |
'name' => 'btn_typography', |
| 1403 |
'label' => __('Typography', 'master-addons'), |
| 1404 |
'global' => array( |
| 1405 |
'default' => Global_Typography::TYPOGRAPHY_ACCENT, |
| 1406 |
), |
| 1407 |
'selector' => '{{WRAPPER}} .jltma-ff-style .ff_submit_btn_wrapper button.ff-btn-submit, |
| 1408 |
{{WRAPPER}} .jltma-ff-style .fluentform .step-nav button.ff-btn-secondary, |
| 1409 |
{{WRAPPER}} .jltma-ff-style .fluentform .ff_upload_btn', |
| 1410 |
) |
| 1411 |
); |
| 1412 |
|
| 1413 |
$this->end_controls_section(); |
| 1414 |
} |
| 1415 |
|
| 1416 |
/** |
| 1417 |
* Render the widget output on the frontend. |
| 1418 |
*/ |
| 1419 |
protected function render() |
| 1420 |
{ |
| 1421 |
$settings = $this->get_settings_for_display(); |
| 1422 |
$form_title = ''; |
| 1423 |
$description = ''; |
| 1424 |
|
| 1425 |
if ('yes' === $settings['form_title_option']) { |
| 1426 |
$form_title = $this->get_settings_for_display('form_title'); |
| 1427 |
$description = $this->get_settings_for_display('form_desc'); |
| 1428 |
} |
| 1429 |
?> |
| 1430 |
<div class="jltma-ff-style elementor-clickable"> |
| 1431 |
<?php |
| 1432 |
|
| 1433 |
if ('' !== $form_title) { |
| 1434 |
$title_size_tag = self::jltma_validate_html_tag($settings['form_title_tag']); |
| 1435 |
?> |
| 1436 |
|
| 1437 |
<<?php echo esc_attr($title_size_tag); ?> class="jltma-ff-form-title"><?php echo wp_kses_post($form_title); ?></<?php echo esc_attr($title_size_tag); ?>> |
| 1438 |
<?php |
| 1439 |
} |
| 1440 |
|
| 1441 |
if ('' !== $description) { |
| 1442 |
?> |
| 1443 |
|
| 1444 |
<p class="jltma-ff-form-desc"><?php echo wp_kses_post($description); ?></p> |
| 1445 |
|
| 1446 |
<?php |
| 1447 |
} |
| 1448 |
|
| 1449 |
if ('0' === $settings['form_id']) { |
| 1450 |
|
| 1451 |
esc_attr_e('Please select a WP Fluent Form', 'master-addons'); |
| 1452 |
} elseif ($settings['form_id']) { |
| 1453 |
|
| 1454 |
$shortcode_extra = ''; |
| 1455 |
$shortcode_extra = apply_filters('jltma_ff_shortcode_extra_param', '', absint($settings['form_id'])); |
| 1456 |
|
| 1457 |
echo do_shortcode('[fluentform id=' . absint($settings['form_id']) . $shortcode_extra . ']'); |
| 1458 |
} |
| 1459 |
?> |
| 1460 |
|
| 1461 |
</div> |
| 1462 |
<?php |
| 1463 |
} |
| 1464 |
} |
| 1465 |
|