| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Widgets; |
| 4 |
|
| 5 |
use FluentForm\App\Helpers\Helper; |
| 6 |
|
| 7 |
class OxyFluentFormWidget extends OxygenEl |
| 8 |
{ |
| 9 |
public $css_added = false; |
| 10 |
|
| 11 |
public function name() |
| 12 |
{ |
| 13 |
return __('Fluent Form', 'fluentform'); |
| 14 |
} |
| 15 |
|
| 16 |
public function slug() |
| 17 |
{ |
| 18 |
return 'form_widget'; |
| 19 |
} |
| 20 |
|
| 21 |
public function accordion_button_place() |
| 22 |
{ |
| 23 |
return 'form'; |
| 24 |
} |
| 25 |
|
| 26 |
public function icon() |
| 27 |
{ |
| 28 |
return ''; |
| 29 |
} |
| 30 |
|
| 31 |
public function controls() |
| 32 |
{ |
| 33 |
$templates_control = $this->addOptionControl( |
| 34 |
[ |
| 35 |
'type' => 'dropdown', |
| 36 |
'name' => __('Select a Form', 'fluentform'), |
| 37 |
'slug' => 'ff_form', |
| 38 |
'value' => Helper::getForms(), |
| 39 |
'default' => 'no', |
| 40 |
'css' => false, |
| 41 |
] |
| 42 |
); |
| 43 |
$templates_control->rebuildElementOnChange(); |
| 44 |
|
| 45 |
$this->formContainerStyleControls(); |
| 46 |
$this->formInputLabelsStyle(); |
| 47 |
$this->formInputsStyle(); |
| 48 |
$this->checkboxAndRadioStyle(); |
| 49 |
$this->gdprAndTermsConditionStyle(); |
| 50 |
$this->sectionBreakStyle(); |
| 51 |
$this->checkboxGridStyle(); |
| 52 |
$this->fileUploadStyle(); |
| 53 |
$this->progressBarStyle(); |
| 54 |
$this->submitBtnStyle(); |
| 55 |
$this->stepButtonStyle(); |
| 56 |
$this->successMessageStyle(); |
| 57 |
$this->errorMessageStyle(); |
| 58 |
} |
| 59 |
|
| 60 |
public function formContainerStyleControls() |
| 61 |
{ |
| 62 |
$section_container = $this->addControlSection( |
| 63 |
'fluentform_container', |
| 64 |
__('Form Container', 'fluentform'), |
| 65 |
'assets/icon.png', |
| 66 |
$this |
| 67 |
); |
| 68 |
$selector = '.fluentform'; |
| 69 |
$section_container->addStyleControls( |
| 70 |
[ |
| 71 |
[ |
| 72 |
'name' => __('Background Color', 'fluentform'), |
| 73 |
'selector' => $selector, |
| 74 |
'property' => 'background-color', |
| 75 |
], |
| 76 |
[ |
| 77 |
'name' => __('Max Width', 'fluentform'), |
| 78 |
'selector' => $selector, |
| 79 |
'property' => 'width', |
| 80 |
], |
| 81 |
] |
| 82 |
); |
| 83 |
|
| 84 |
$section_container->addPreset( |
| 85 |
'padding', |
| 86 |
'fluentform_container_padding', |
| 87 |
__('Padding', 'fluentform'), |
| 88 |
$selector |
| 89 |
)->whiteList(); |
| 90 |
|
| 91 |
$section_container->addPreset( |
| 92 |
'margin', |
| 93 |
'fluentform_container_margin', |
| 94 |
__('Margin', 'fluentform'), |
| 95 |
$selector |
| 96 |
)->whiteList(); |
| 97 |
|
| 98 |
$section_container->addPreset( |
| 99 |
'border', |
| 100 |
'fluentform_container_border', |
| 101 |
__('Border', 'fluentform'), |
| 102 |
$selector |
| 103 |
)->whiteList(); |
| 104 |
|
| 105 |
$section_container->addPreset( |
| 106 |
'border-radius', |
| 107 |
'fluentform_container_radius', |
| 108 |
__('Border Radius', 'fluentform'), |
| 109 |
$selector |
| 110 |
)->whiteList(); |
| 111 |
|
| 112 |
$section_container->boxShadowSection( |
| 113 |
__('Box Shadow', 'fluentform'), |
| 114 |
$selector, |
| 115 |
$this |
| 116 |
); |
| 117 |
} |
| 118 |
|
| 119 |
public function formInputLabelsStyle() |
| 120 |
{ |
| 121 |
$section_label = $this->addControlSection( |
| 122 |
'fluentform_label', |
| 123 |
__('Labels', 'fluentform'), |
| 124 |
'assets/icon.png', |
| 125 |
$this |
| 126 |
); |
| 127 |
|
| 128 |
$selector = '.fluentform .ff-el-input--label label'; |
| 129 |
$section_label->typographySection(__('Typography'), $selector, $this); |
| 130 |
$section_label->addStyleControls( |
| 131 |
[ |
| 132 |
[ |
| 133 |
'name' => __('Text Color', 'fluentform'), |
| 134 |
'selector' => $selector, |
| 135 |
'property' => 'color', |
| 136 |
], |
| 137 |
] |
| 138 |
); |
| 139 |
$section_label->addStyleControl( |
| 140 |
[ |
| 141 |
'name' => __('Asterisk Color', 'fluentform'), |
| 142 |
'selector' => '.ff-el-input--label.ff-el-is-required.asterisk-right label:after ,.ff-el-input--label.ff-el-is-required.asterisk-left label:before', |
| 143 |
'property' => 'color', |
| 144 |
] |
| 145 |
); |
| 146 |
} |
| 147 |
|
| 148 |
public function formInputsStyle() |
| 149 |
{ |
| 150 |
$selector = '.ff-el-form-control'; |
| 151 |
$section_input = $this->addControlSection( |
| 152 |
'fluentform_input', |
| 153 |
__('Input & Textara', 'fluentform'), |
| 154 |
'assets/icon.png', |
| 155 |
$this |
| 156 |
); |
| 157 |
|
| 158 |
$section_input->addStyleControls( |
| 159 |
[ |
| 160 |
[ |
| 161 |
'name' => __('Text Indent', 'fluentform'), |
| 162 |
'selector' => $selector, |
| 163 |
'property' => 'padding-left', |
| 164 |
'control_type' => 'slider-measurebox', |
| 165 |
'unit' => 'px', |
| 166 |
], |
| 167 |
[ |
| 168 |
'name' => __('Margin Bottom'), |
| 169 |
'selector' => '.ff-el-group', |
| 170 |
'property' => 'margin-bottom', |
| 171 |
], |
| 172 |
[ |
| 173 |
'name' => __('Input Width', 'fluentform'), |
| 174 |
'selector' => $selector, |
| 175 |
'property' => 'width', |
| 176 |
'control_type' => 'slider-measurebox', |
| 177 |
'unit' => 'px', |
| 178 |
], |
| 179 |
[ |
| 180 |
'name' => __('Input Height', 'fluentform'), |
| 181 |
'selector' => $selector, |
| 182 |
'property' => 'height', |
| 183 |
'control_type' => 'slider-measurebox', |
| 184 |
'unit' => 'px', |
| 185 |
], |
| 186 |
[ |
| 187 |
'name' => __('Textarea Width', 'fluentform'), |
| 188 |
'selector' => '.ff-el-group textarea', |
| 189 |
'property' => 'width', |
| 190 |
'control_type' => 'slider-measurebox', |
| 191 |
'unit' => 'px', |
| 192 |
], |
| 193 |
[ |
| 194 |
'name' => __('Textarea Height', 'fluentform'), |
| 195 |
'selector' => '.ff-el-group textarea', |
| 196 |
'property' => 'height', |
| 197 |
'control_type' => 'slider-measurebox', |
| 198 |
'unit' => 'px', |
| 199 |
], |
| 200 |
] |
| 201 |
); |
| 202 |
|
| 203 |
$section_input_normal = $section_input->addControlSection( |
| 204 |
'fluentform_input_normal_section', |
| 205 |
__('Normal', 'fluentform'), |
| 206 |
'assets/icon.png', |
| 207 |
$this |
| 208 |
); |
| 209 |
|
| 210 |
$section_input_normal->addStyleControls( |
| 211 |
[ |
| 212 |
[ |
| 213 |
'name' => __('Color'), |
| 214 |
'selector' => '.ff-el-form-control', |
| 215 |
'property' => 'color', |
| 216 |
], |
| 217 |
[ |
| 218 |
'name' => __('Background Color'), |
| 219 |
'selector' => '.ff-el-form-control', |
| 220 |
'property' => 'background-color', |
| 221 |
], |
| 222 |
[ |
| 223 |
'name' => __('Placeholder Color'), |
| 224 |
'slug' => 'fluentform_input_placeholder', |
| 225 |
'selector' => '::placeholder', |
| 226 |
'property' => 'color', |
| 227 |
], |
| 228 |
] |
| 229 |
); |
| 230 |
|
| 231 |
$section_input_hover = $section_input->addControlSection( |
| 232 |
'fluentform_input_hover_section', |
| 233 |
__('Hover', 'fluentform'), |
| 234 |
'assets/icon.png', |
| 235 |
$this |
| 236 |
); |
| 237 |
|
| 238 |
$section_input_hover->addStyleControls( |
| 239 |
[ |
| 240 |
[ |
| 241 |
'name' => __('Background Color'), |
| 242 |
'selector' => '.ff-el-form-control:focus', |
| 243 |
'property' => 'background-color', |
| 244 |
], |
| 245 |
[ |
| 246 |
'name' => __('Text Color'), |
| 247 |
'selector' => '.ff-el-form-control:focus', |
| 248 |
'property' => 'color', |
| 249 |
], |
| 250 |
[ |
| 251 |
'name' => __('Border Color'), |
| 252 |
'selector' => '.ff-el-form-control:focus', |
| 253 |
'property' => 'border-color', |
| 254 |
'control_type' => 'colorpicker', |
| 255 |
], |
| 256 |
] |
| 257 |
); |
| 258 |
|
| 259 |
$section_input->addPreset( |
| 260 |
'padding', |
| 261 |
'fluentform_input_spacing', |
| 262 |
__('Padding', 'fluentform'), |
| 263 |
$selector |
| 264 |
)->whiteList(); |
| 265 |
|
| 266 |
$section_input->boxShadowSection( |
| 267 |
__('Box Shadow', 'fluentform'), |
| 268 |
$selector, |
| 269 |
$this |
| 270 |
); |
| 271 |
|
| 272 |
$section_input->typographySection( |
| 273 |
__('Typography'), |
| 274 |
$selector, |
| 275 |
$this |
| 276 |
); |
| 277 |
|
| 278 |
$section_input->addPreset( |
| 279 |
'border', |
| 280 |
'fluentform_input_border', |
| 281 |
__('Border', 'fluentform'), |
| 282 |
$selector |
| 283 |
)->whiteList(); |
| 284 |
|
| 285 |
$section_input->addPreset( |
| 286 |
'border-radius', |
| 287 |
'fluentform_input_border_radius', |
| 288 |
__('Border Radius', 'fluentform'), |
| 289 |
$selector |
| 290 |
)->whiteList(); |
| 291 |
} |
| 292 |
|
| 293 |
public function checkboxGridStyle() |
| 294 |
{ |
| 295 |
$section_checkbox_grid = $this->addControlSection( |
| 296 |
'fluentform_checkbox_grid', |
| 297 |
__('Checkable Grid Field', 'fluentform'), |
| 298 |
'assets/icon.png', |
| 299 |
$this |
| 300 |
); |
| 301 |
|
| 302 |
$section_checkbox_grid_spacing = $section_checkbox_grid->addControlSection( |
| 303 |
'fluentform_checkbox_grid_sp', |
| 304 |
__('Spacing', 'fluentform'), |
| 305 |
'assets/icon.png', |
| 306 |
$this |
| 307 |
); |
| 308 |
$section_checkbox_grid_width = $section_checkbox_grid_spacing->addStyleControl( |
| 309 |
[ |
| 310 |
'selector' => '.fluentform .ff-checkable-grids', |
| 311 |
'property' => 'width', |
| 312 |
'control_type' => 'slider-measurebox', |
| 313 |
] |
| 314 |
); |
| 315 |
$section_checkbox_grid_width->setRange('0', '100', '1'); |
| 316 |
$section_checkbox_grid_width->setUnits('%', 'px,%,em'); |
| 317 |
$section_checkbox_grid_width->setDefaultValue('100'); |
| 318 |
|
| 319 |
$section_checkbox_grid_spacing->addPreset( |
| 320 |
'padding', |
| 321 |
'fluentform_checkbox_grid_padding', |
| 322 |
__('Table Head Cell Padding'), |
| 323 |
'.fluentform .ff-checkable-grids thead>tr>th' |
| 324 |
)->whiteList(); |
| 325 |
|
| 326 |
$section_checkbox_grid_spacing->addPreset( |
| 327 |
'padding', |
| 328 |
'fluentform_checkbox_grid_padding_tb', |
| 329 |
__('Table Body Cell Padding'), |
| 330 |
'.fluentform .ff-checkable-grids tbody>tr>td' |
| 331 |
)->whiteList(); |
| 332 |
|
| 333 |
$section_checkbox_grid_color = $section_checkbox_grid->addControlSection( |
| 334 |
'fluentform_checkbox_grid_color', |
| 335 |
__('Color', 'fluentform'), |
| 336 |
'assets/icon.png', |
| 337 |
$this |
| 338 |
); |
| 339 |
$section_checkbox_grid_color->addStyleControls([ |
| 340 |
[ |
| 341 |
'name' => __('Table Outer Border Width', 'fluentform'), |
| 342 |
'selector' => '.fluentform .ff-checkable-grids', |
| 343 |
'property' => 'border-width', |
| 344 |
], |
| 345 |
[ |
| 346 |
'name' => __('Table Outer Border Color', 'fluentform'), |
| 347 |
'selector' => '.fluentform .ff-checkable-grids', |
| 348 |
'property' => 'border-color', |
| 349 |
], |
| 350 |
[ |
| 351 |
'name' => __('Table Head Background', 'fluentform'), |
| 352 |
'selector' => '.fluentform .ff-checkable-grids thead>tr>th', |
| 353 |
'property' => 'background-color', |
| 354 |
], |
| 355 |
[ |
| 356 |
'name' => __('Table Body Background', 'fluentform'), |
| 357 |
'selector' => '.fluentform .ff-checkable-grids tbody>tr>td', |
| 358 |
'property' => 'background-color', |
| 359 |
], |
| 360 |
[ |
| 361 |
'name' => __('Table Body Alt Background', 'fluentform'), |
| 362 |
'selector' => '.fluentform .ff-checkable-grids tbody>tr:nth-child(2n)>td', |
| 363 |
'property' => 'background-color', |
| 364 |
], |
| 365 |
[ |
| 366 |
'name' => __('Table Body Alt Text Color', 'fluentform'), |
| 367 |
'selector' => '.fluentform .ff-checkable-grids tbody>tr:nth-child(2n)>td', |
| 368 |
'property' => 'color', |
| 369 |
], |
| 370 |
]); |
| 371 |
|
| 372 |
$section_checkbox_grid->typographySection( |
| 373 |
__('Heading Typography', 'fluentform'), |
| 374 |
'.fluentform .ff-checkable-grids thead>tr>th', |
| 375 |
$this |
| 376 |
); |
| 377 |
$section_checkbox_grid->typographySection( |
| 378 |
__('Cell Typography', 'fluentform'), |
| 379 |
'.fluentform .ff-checkable-grids tbody>tr>td', |
| 380 |
$this |
| 381 |
); |
| 382 |
} |
| 383 |
|
| 384 |
public function gdprAndTermsConditionStyle() |
| 385 |
{ |
| 386 |
$section_gdpr_terms = $this->addControlSection( |
| 387 |
'fluentform_gdpr_terms_section', |
| 388 |
__('GDPR, Terms & Condition', 'fluentform'), |
| 389 |
'assets/icon.png', |
| 390 |
$this |
| 391 |
); |
| 392 |
|
| 393 |
$section_gdpr_terms->typographySection(__('Typography'), '.ff-el-tc , .ff_t_c', $this); |
| 394 |
$section_gdpr_terms->addStyleControls( |
| 395 |
[ |
| 396 |
[ |
| 397 |
'name' => __('Text Color', 'fluentform'), |
| 398 |
'selector' => '.ff-el-tc , .ff_t_c', |
| 399 |
'property' => 'color', |
| 400 |
], |
| 401 |
[ |
| 402 |
'name' => __('Link Color', 'fluentform'), |
| 403 |
'selector' => '.ff-el-tc a, .ff_t_c a', |
| 404 |
'property' => 'color', |
| 405 |
], |
| 406 |
] |
| 407 |
); |
| 408 |
} |
| 409 |
|
| 410 |
public function sectionBreakStyle() |
| 411 |
{ |
| 412 |
$section_section_break = $this->addControlSection( |
| 413 |
'fluentform_section_break_section', |
| 414 |
__('Section Break', 'fluentform'), |
| 415 |
'assets/icon.png', |
| 416 |
$this |
| 417 |
); |
| 418 |
|
| 419 |
$selector = '.ff-el-section-break'; |
| 420 |
$section_section_break->typographySection(__('Typography', 'fluentform'), $selector, $this); |
| 421 |
$section_section_break->addStyleControls( |
| 422 |
[ |
| 423 |
[ |
| 424 |
'name' => __('Text Color', 'fluentform'), |
| 425 |
'selector' => $selector, |
| 426 |
'property' => 'color', |
| 427 |
], |
| 428 |
[ |
| 429 |
'selector' => $selector, |
| 430 |
'slug' => 'ff_section_break_section_bg_color', |
| 431 |
'property' => 'background-color', |
| 432 |
], |
| 433 |
] |
| 434 |
); |
| 435 |
$section_section_break->addPreset( |
| 436 |
'padding', |
| 437 |
'ff_section_break_section_padding', |
| 438 |
__('Padding', 'fluentform'), |
| 439 |
$selector |
| 440 |
)->whiteList(); |
| 441 |
|
| 442 |
$section_section_break->addPreset( |
| 443 |
'margin', |
| 444 |
'ff_section_break_section_margin', |
| 445 |
__('Margin', 'fluentform'), |
| 446 |
$selector |
| 447 |
)->whiteList(); |
| 448 |
|
| 449 |
$section_section_break->addStyleControl( |
| 450 |
[ |
| 451 |
'selector' => $selector . ' hr', |
| 452 |
'slug' => 'ffsb_line', |
| 453 |
'property' => 'border-color', |
| 454 |
] |
| 455 |
)->setParam('hide_wrapper_end', true); |
| 456 |
|
| 457 |
$section_section_break->addStyleControl( |
| 458 |
[ |
| 459 |
'selector' => $selector . ' hr', |
| 460 |
'slug' => 'ffsb_linew', |
| 461 |
'property' => 'border-width', |
| 462 |
] |
| 463 |
)->setParam('hide_wrapper_start', true); |
| 464 |
} |
| 465 |
|
| 466 |
public function render($options, $defaults, $content) |
| 467 |
{ |
| 468 |
if ('no' == $options['ff_form']) { |
| 469 |
echo '<h5 class="ff-template-missing">' . __('Select a Form', 'fluentform') . '</h5>'; |
| 470 |
return; |
| 471 |
} |
| 472 |
|
| 473 |
if (function_exists('do_oxygen_elements')) { |
| 474 |
echo do_oxygen_elements('[fluentform id="' . (int) $options['ff_form'] . '"]'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 475 |
} else { |
| 476 |
if (Helper::isConversionForm($options['ff_form'])) { |
| 477 |
_e('This is a Conversational Form. You must use the default Design tab for this type of forms.', 'fluentform'); |
| 478 |
return; |
| 479 |
} |
| 480 |
echo do_shortcode('[fluentform id="' . (int) $options['ff_form'] . '"]'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 481 |
} |
| 482 |
} |
| 483 |
|
| 484 |
public function init() |
| 485 |
{ |
| 486 |
$this->El->useAJAXControls(); |
| 487 |
|
| 488 |
$app = wpFluentForm(); |
| 489 |
|
| 490 |
if ($app->request->get('ct_builder')) { |
| 491 |
wp_enqueue_style( |
| 492 |
'fluent-form-styles', |
| 493 |
$app->publicUrl('css/fluent-forms-public.css'), |
| 494 |
[], |
| 495 |
FLUENTFORM_VERSION |
| 496 |
); |
| 497 |
|
| 498 |
wp_enqueue_style( |
| 499 |
'fluentform-public-default', |
| 500 |
$app->publicUrl('css/fluentform-public-default.css'), |
| 501 |
[], |
| 502 |
FLUENTFORM_VERSION |
| 503 |
); |
| 504 |
|
| 505 |
if (!wp_script_is('flatpickr', 'registered')) { |
| 506 |
wp_enqueue_style( |
| 507 |
'flatpickr', |
| 508 |
$app->publicUrl('libs/flatpickr/flatpickr.min.css') |
| 509 |
); |
| 510 |
} |
| 511 |
|
| 512 |
wp_enqueue_style( |
| 513 |
'ff_choices', |
| 514 |
$app->publicUrl('css/choices.css'), |
| 515 |
[], |
| 516 |
FLUENTFORM_VERSION |
| 517 |
); |
| 518 |
} |
| 519 |
} |
| 520 |
|
| 521 |
public function enablePresets() |
| 522 |
{ |
| 523 |
return true; |
| 524 |
} |
| 525 |
|
| 526 |
public function enableFullPresets() |
| 527 |
{ |
| 528 |
return true; |
| 529 |
} |
| 530 |
|
| 531 |
public function customCSS($options, $selector) |
| 532 |
{ |
| 533 |
$css = $defaultCSS = ''; |
| 534 |
|
| 535 |
$prefix = 'oxy-' . $this->slug(); |
| 536 |
|
| 537 |
if (isset($options[$prefix . '_ff_inp_placeholder'])) { |
| 538 |
$css .= '.fluent_form_' . $options['fluentform'] . ' .ff-el-form-control::-webkit-input-placeholder,.fluent_form_' . $options['fluentform'] . ' .ff-el-form-control::-moz-input-placeholder,.fluent_form_' . $options['fluentform'] . ' .ff-el-form-control:-ms-input-placeholder,.fluent_form_' . $options['fluentform'] . ' .ff-el-form-control::placeholder{color:' . $options['ff_inp_placeholder'] . ';}'; |
| 539 |
} |
| 540 |
|
| 541 |
if (isset($options[$prefix . '_rc_smart_ui']) && 'yes' == $options[$prefix . '_rc_smart_ui']) { |
| 542 |
$css .= $selector . ' .ff-el-group input[type=checkbox]:after, ' . $selector . ' .ff-el-group input[type=radio]:after {content: " "!important;display: inline-block!important;border-style: solid}'; |
| 543 |
$css .= $selector . ' .ff-el-group input[type=checkbox], ' . $selector . ' .ff-el-group input[type=radio]{width: 1px;}'; |
| 544 |
} else { |
| 545 |
$css .= $selector . ' .ff-el-group input[type=checkbox]:after, ' . $selector . ' .ff-el-group input[type=radio]:after {content: none;}'; |
| 546 |
} |
| 547 |
|
| 548 |
return $defaultCSS . $css; |
| 549 |
} |
| 550 |
|
| 551 |
public function checkboxAndRadioStyle() |
| 552 |
{ |
| 553 |
$input_section_radio_checkbox = $this->addControlSection( |
| 554 |
'fluentform_checkbox_radio_style', |
| 555 |
__('Checkbox & Radio', 'fluentform'), |
| 556 |
'assets/icon.png', |
| 557 |
$this |
| 558 |
); |
| 559 |
$selector_after = '.ff-el-group input[type=checkbox]:after,.ff-el-group input[type=radio]:after'; |
| 560 |
$selector = '.ff-el-group input[type=checkbox],.ff-el-group input[type=radio]'; |
| 561 |
|
| 562 |
$text = $input_section_radio_checkbox->addControlSection( |
| 563 |
'fluentform_radio_checkbox_text', |
| 564 |
__('Text Style', 'fluentform'), |
| 565 |
'assets/icon.png', |
| 566 |
$this |
| 567 |
); |
| 568 |
|
| 569 |
$text->addStyleControls( |
| 570 |
[ |
| 571 |
[ |
| 572 |
'selector' => '.ff-el-form-check-label, .ff_t_c', |
| 573 |
'property' => 'color', |
| 574 |
'name' => __('Text Color', 'fluentform'), |
| 575 |
], |
| 576 |
[ |
| 577 |
'selector' => '.ff_t_c a', |
| 578 |
'property' => 'color', |
| 579 |
'name' => __('Link Color', 'fluentform'), |
| 580 |
], |
| 581 |
[ |
| 582 |
'selector' => '.ff_t_c a:hover', |
| 583 |
'property' => 'color', |
| 584 |
'name' => __('Link Hover Color', 'fluentform'), |
| 585 |
], |
| 586 |
[ |
| 587 |
'selector' => '.ff-el-form-check-label, .ff_t_c', |
| 588 |
'property' => 'font-size', |
| 589 |
'control_type' => 'slider-measurebox', |
| 590 |
'name' => __('Text Font Size', 'fluentform'), |
| 591 |
'unit' => 'px', |
| 592 |
], |
| 593 |
] |
| 594 |
); |
| 595 |
|
| 596 |
$smart_ui = $input_section_radio_checkbox->addControlSection( |
| 597 |
'fluentform_radio_checkbox_smart_ui', |
| 598 |
__('Checkbox/Radio Smart UI', 'fluentform'), |
| 599 |
'assets/icon.png', |
| 600 |
$this |
| 601 |
); |
| 602 |
$smart_ui->addOptionControl( |
| 603 |
[ |
| 604 |
'type' => 'radio', |
| 605 |
'name' => __('Enable Smart UI', 'fluentform'), |
| 606 |
'slug' => 'rc_smart_ui', |
| 607 |
'value' => ['yes' => __('Yes'), 'no' => __('No')], |
| 608 |
'default' => 'no', |
| 609 |
'css' => false, |
| 610 |
] |
| 611 |
)->rebuildElementOnChange(); |
| 612 |
|
| 613 |
$smart_ui->addStyleControl( |
| 614 |
[ |
| 615 |
'selector' => $selector_after, |
| 616 |
'name' => __('Width'), |
| 617 |
'property' => 'width|height', |
| 618 |
'control_type' => 'slider-measurebox', |
| 619 |
'unit' => 'px', |
| 620 |
'condition' => 'rc_smart_ui=yes', |
| 621 |
] |
| 622 |
); |
| 623 |
$smart_ui->addStyleControl( |
| 624 |
[ |
| 625 |
'selector' => $selector, |
| 626 |
'name' => __('Text Indent'), |
| 627 |
'property' => 'margin-right', |
| 628 |
'control_type' => 'slider-measurebox', |
| 629 |
'unit' => 'px', |
| 630 |
'condition' => 'rc_smart_ui=yes', |
| 631 |
] |
| 632 |
); |
| 633 |
$smart_ui->addStyleControls( |
| 634 |
[ |
| 635 |
[ |
| 636 |
'selector' => $selector_after, |
| 637 |
'property' => 'background-color', |
| 638 |
'slug' => 'cr_bg_color', |
| 639 |
'condition' => 'rc_smart_ui=yes', |
| 640 |
], |
| 641 |
[ |
| 642 |
'selector' => $selector_after, |
| 643 |
'property' => 'border-color', |
| 644 |
'slug' => 'cr_brd_color', |
| 645 |
'condition' => 'rc_smart_ui=yes', |
| 646 |
'value' => '#333', |
| 647 |
], |
| 648 |
[ |
| 649 |
'selector' => $selector_after . ', .ff-el-group input[type=checkbox]:checked:after, .ff-el-group input[type=radio]:checked:after', |
| 650 |
'property' => 'border-width', |
| 651 |
'condition' => 'rc_smart_ui=yes', |
| 652 |
], |
| 653 |
[ |
| 654 |
'name' => __('Border Radius for Checkbox', 'fluentform'), |
| 655 |
'selector' => '.ff-el-group input[type=checkbox]:after, .ff-el-group input[type=checkbox]:checked:after', |
| 656 |
'property' => 'border-radius', |
| 657 |
'condition' => 'rc_smart_ui=yes', |
| 658 |
], |
| 659 |
] |
| 660 |
); |
| 661 |
|
| 662 |
$smart_ui->addStyleControls( |
| 663 |
[ |
| 664 |
[ |
| 665 |
'name' => __('Background Color - Selected State', 'fluentform'), |
| 666 |
'selector' => '.ff-el-group input[type=checkbox]:checked:after, .ff-el-group input[type=radio]:checked:after', |
| 667 |
'property' => 'background-color', |
| 668 |
'control_type' => 'colorpicker', |
| 669 |
'condition' => 'rc_smart_ui=yes', |
| 670 |
], |
| 671 |
[ |
| 672 |
'name' => __('Border Size - Selected State', 'fluentform'), |
| 673 |
'selector' => '.ff-el-group input[type=checkbox]:checked:after, .ff-el-group input[type=radio]:checked:after', |
| 674 |
'property' => 'border-width', |
| 675 |
'control_type' => 'slider-measurebox', |
| 676 |
'unit' => 'px', |
| 677 |
'condition' => 'rc_smart_ui=yes', |
| 678 |
], |
| 679 |
[ |
| 680 |
'name' => __('Border Color - Selected State', 'fluentform'), |
| 681 |
'selector' => '.ff-el-group input[type=checkbox]:checked:after, .ff-el-group input[type=radio]:checked:after', |
| 682 |
'property' => 'border-color', |
| 683 |
'slug' => 'crc_bg_color', |
| 684 |
'control_type' => 'colorpicker', |
| 685 |
'condition' => 'rc_smart_ui=yes', |
| 686 |
], |
| 687 |
] |
| 688 |
); |
| 689 |
|
| 690 |
$input_section_radio_checkbox_space = $input_section_radio_checkbox->addControlSection( |
| 691 |
'fluentform_radio_checkbox_sp', |
| 692 |
__('Spacing', 'fluentform'), |
| 693 |
'assets/icon.png', |
| 694 |
$this |
| 695 |
); |
| 696 |
|
| 697 |
$input_section_radio_checkbox_space->addPreset( |
| 698 |
'margin', |
| 699 |
'fluentform_radio_checkbox_margin', |
| 700 |
__('Checkbox/Radio Margin'), |
| 701 |
'.fluentform input[type=checkbox], .ff-el-group input[type=radio]' |
| 702 |
)->whiteList(); |
| 703 |
|
| 704 |
$input_section_radio_checkbox_space->addPreset( |
| 705 |
'padding', |
| 706 |
'fluentform_radio_checkbox_padding', |
| 707 |
__('Label Spacing'), |
| 708 |
'.ff-el-form-check-label, .ff_t_c' |
| 709 |
)->whiteList(); |
| 710 |
} |
| 711 |
|
| 712 |
public function fileUploadStyle() |
| 713 |
{ |
| 714 |
$section_file_upload = $this->addControlSection( |
| 715 |
'fluentform_file_upload', |
| 716 |
__('File Upload Field', 'fluentform'), |
| 717 |
'assets/icon.png', |
| 718 |
$this |
| 719 |
); |
| 720 |
$selector = '.ff_upload_btn'; |
| 721 |
|
| 722 |
$section_file_upload->typographySection(__('Button Typography', 'fluentform'), $selector, $this); |
| 723 |
$section_file_upload->borderSection(__('Button Border', 'fluentform'), $selector, $this); |
| 724 |
$section_file_upload->boxShadowSection(__('Button Box Shadow', 'fluentform'), $selector, $this); |
| 725 |
$section_file_upload->boxShadowSection(__('Button Hover Box Shadow', 'fluentform'), $selector . ':hover', $this); |
| 726 |
$section_file_upload->borderSection(__('Button Hover Border', 'fluentform'), $selector . ':hover', $this); |
| 727 |
|
| 728 |
$button = $section_file_upload->addControlSection( |
| 729 |
'fluentform_file_upload_bttn', |
| 730 |
__('Button Style', 'fluentform'), |
| 731 |
'assets/icon.png', |
| 732 |
$this |
| 733 |
); |
| 734 |
$button->addPreset( |
| 735 |
'padding', |
| 736 |
'fluentform_file_upload_bttn_padding', |
| 737 |
__('Padding', 'fluentform'), |
| 738 |
$selector |
| 739 |
)->whiteList(); |
| 740 |
|
| 741 |
$button->addStyleControls( |
| 742 |
[ |
| 743 |
[ |
| 744 |
'name' => __('Text Hover Color', 'fluentform'), |
| 745 |
'selector' => $selector . ':hover', |
| 746 |
'property' => 'color', |
| 747 |
], |
| 748 |
[ |
| 749 |
'selector' => $selector, |
| 750 |
'property' => 'background-color', |
| 751 |
], |
| 752 |
[ |
| 753 |
'name' => __('Background Hover Color', 'fluentform'), |
| 754 |
'selector' => $selector . ':Hover', |
| 755 |
'property' => 'background-color', |
| 756 |
'control_type' => 'colorpicker', |
| 757 |
], |
| 758 |
[ |
| 759 |
'name' => __('Width', 'fluentform'), |
| 760 |
'selector' => $selector, |
| 761 |
'property' => 'width', |
| 762 |
], |
| 763 |
] |
| 764 |
); |
| 765 |
} |
| 766 |
|
| 767 |
public function progressBarStyle() |
| 768 |
{ |
| 769 |
$section_progressbar = $this->addControlSection( |
| 770 |
'fluentform_progress_bar', |
| 771 |
__('Progress Bar', 'fluentform'), |
| 772 |
'assets/icon.png', |
| 773 |
$this |
| 774 |
); |
| 775 |
|
| 776 |
$section_progressbar->typographySection(__('Typography', 'fluentform'), '.ff-el-progress-status', $this); |
| 777 |
$section_progressbar->addStyleControls( |
| 778 |
[ |
| 779 |
[ |
| 780 |
'name' => __('Text Color', 'fluentform'), |
| 781 |
'selector' => '.ff-el-progress-status', |
| 782 |
'property' => 'color', |
| 783 |
], |
| 784 |
] |
| 785 |
); |
| 786 |
$section_progressbar->addStyleControls( |
| 787 |
[ |
| 788 |
[ |
| 789 |
'name' => __('Bar Color', 'fluentform'), |
| 790 |
'selector' => '.ff-el-progress-bar', |
| 791 |
'property' => 'background-color', |
| 792 |
], |
| 793 |
] |
| 794 |
); |
| 795 |
$section_progressbar->addPreset( |
| 796 |
'padding', |
| 797 |
'fluentform_progress_bar_padding', |
| 798 |
__('Label Spacing', 'fluentform'), |
| 799 |
'.ff-el-progress-status' |
| 800 |
)->whiteList(); |
| 801 |
} |
| 802 |
|
| 803 |
public function submitBtnStyle() |
| 804 |
{ |
| 805 |
$section_submit_btn = $this->addControlSection( |
| 806 |
'fluentform_submit_bttn', |
| 807 |
__('Submit Button', 'fluentform'), |
| 808 |
'assets/icon.png', |
| 809 |
$this |
| 810 |
); |
| 811 |
|
| 812 |
$selector_submit_bttn = '.ff-btn-submit'; |
| 813 |
$section_submit_btn->addStyleControls( |
| 814 |
[ |
| 815 |
[ |
| 816 |
'name' => __('Color', 'fluentform'), |
| 817 |
'selector' => $selector_submit_bttn, |
| 818 |
'property' => 'color', |
| 819 |
], |
| 820 |
[ |
| 821 |
'name' => __('Background Color', 'fluentform'), |
| 822 |
'selector' => $selector_submit_bttn, |
| 823 |
'property' => 'background-color', |
| 824 |
], |
| 825 |
[ |
| 826 |
'name' => __('Hover Color', 'fluentform'), |
| 827 |
'selector' => '.ff-btn-submit:hover', |
| 828 |
'property' => 'background-color', |
| 829 |
], |
| 830 |
[ |
| 831 |
'name' => __('Width', 'fluentform'), |
| 832 |
'selector' => $selector_submit_bttn, |
| 833 |
'property' => 'width', |
| 834 |
'control_type' => 'slider-measurebox', |
| 835 |
'unit' => 'px', |
| 836 |
], |
| 837 |
[ |
| 838 |
'name' => __('Margin Top', 'fluentform'), |
| 839 |
'selector' => $selector_submit_bttn, |
| 840 |
'property' => 'margin-top', |
| 841 |
'control_type' => 'slider-measurebox', |
| 842 |
'unit' => 'px', |
| 843 |
], |
| 844 |
] |
| 845 |
); |
| 846 |
|
| 847 |
$section_submit_btn->addPreset( |
| 848 |
'padding', |
| 849 |
'fluentform_submit_bttn_padding', |
| 850 |
__('Padding', 'fluentform'), |
| 851 |
$selector_submit_bttn |
| 852 |
)->whiteList(); |
| 853 |
|
| 854 |
$section_submit_btn->addPreset( |
| 855 |
'margin', |
| 856 |
'fluentform_submit_bttn_margin', |
| 857 |
__('Margin', 'fluentform'), |
| 858 |
$selector_submit_bttn |
| 859 |
)->whiteList(); |
| 860 |
|
| 861 |
$section_submit_btn->typographySection(__('Typography', 'fluentform'), $selector_submit_bttn, $this); |
| 862 |
$section_submit_btn->borderSection(__('Border', 'fluentform'), $selector_submit_bttn, $this); |
| 863 |
$section_submit_btn->borderSection(__('Hover Border', 'fluentform'), $selector_submit_bttn . ':hover', $this); |
| 864 |
$section_submit_btn->boxShadowSection(__('Box Shadow', 'fluentform'), $selector_submit_bttn, $this); |
| 865 |
$section_submit_btn->boxShadowSection(__('Hover Box Shadow', 'fluentform'), $selector_submit_bttn . ':hover', $this); |
| 866 |
} |
| 867 |
|
| 868 |
public function stepButtonStyle() |
| 869 |
{ |
| 870 |
$section_step_button = $this->addControlSection( |
| 871 |
'section_step_button', |
| 872 |
__('Step Button', 'fluentform'), |
| 873 |
'assets/icon.png', |
| 874 |
$this |
| 875 |
); |
| 876 |
|
| 877 |
$section_step_button->addPreset( |
| 878 |
'padding', |
| 879 |
'section_step_button_padding', |
| 880 |
__('Padding', 'fluentform'), |
| 881 |
'.step-nav button' |
| 882 |
)->whiteList(); |
| 883 |
|
| 884 |
$section_step_button->addStyleControl( |
| 885 |
[ |
| 886 |
'name' => __('Width'), |
| 887 |
'selector' => '.step-nav .ff-btn', |
| 888 |
'property' => 'width', |
| 889 |
] |
| 890 |
); |
| 891 |
$section_step_button_color = $section_step_button->addControlSection( |
| 892 |
'ffsfnb_clr', |
| 893 |
__('Color', 'fluentform'), |
| 894 |
'assets/icon.png', |
| 895 |
$this |
| 896 |
); |
| 897 |
$section_step_button_color->addStyleControls( |
| 898 |
[ |
| 899 |
[ |
| 900 |
'name' => __('Text Color', 'fluentform'), |
| 901 |
'selector' => '.step-nav .ff-btn', |
| 902 |
'property' => 'color', |
| 903 |
], |
| 904 |
[ |
| 905 |
'name' => __('Text Hover Color', 'fluentform'), |
| 906 |
'selector' => '.step-nav .ff-btn:hover', |
| 907 |
'property' => 'color', |
| 908 |
], |
| 909 |
[ |
| 910 |
'name' => __('Background Color', 'fluentform'), |
| 911 |
'selector' => '.step-nav .ff-btn', |
| 912 |
'property' => 'background-color', |
| 913 |
'control_type' => 'colorpicker', |
| 914 |
], |
| 915 |
[ |
| 916 |
'name' => __('Background Hover Color', 'fluentform'), |
| 917 |
'selector' => '.step-nav .ff-btn:hover', |
| 918 |
'property' => 'background-color', |
| 919 |
'control_type' => 'colorpicker', |
| 920 |
], |
| 921 |
] |
| 922 |
); |
| 923 |
|
| 924 |
$section_step_button->typographySection(__('Typography', 'fluentform'), '.step-nav .ff-btn', $this); |
| 925 |
$section_step_button->borderSection(__('Border', 'fluentform'), '.step-nav .ff-btn', $this); |
| 926 |
$section_step_button->borderSection(__('Hover Border', 'fluentform'), '.step-nav .ff-btn:hover', $this); |
| 927 |
$section_step_button->boxShadowSection(__('Box Shadow', 'fluentform'), '.step-nav .ff-btn', $this); |
| 928 |
$section_step_button->boxShadowSection(__('Hover Box Shadow', 'fluentform'), '.step-nav .ff-btn:hover', $this); |
| 929 |
} |
| 930 |
|
| 931 |
public function successMessageStyle() |
| 932 |
{ |
| 933 |
$section_success_message = $this->addControlSection( |
| 934 |
'fluentform_success_message', |
| 935 |
__('Success Message', 'fluentform'), |
| 936 |
'assets/icon.png', |
| 937 |
$this |
| 938 |
); |
| 939 |
|
| 940 |
$section_success_message->addStyleControl( |
| 941 |
[ |
| 942 |
'selector' => '.ff-message-success', |
| 943 |
'value' => 100, |
| 944 |
'property' => 'width', |
| 945 |
] |
| 946 |
)->setUnits('%', 'px,%'); |
| 947 |
|
| 948 |
$section_success_message->addStyleControl( |
| 949 |
[ |
| 950 |
'selector' => '.ff-message-success', |
| 951 |
'property' => 'background-color', |
| 952 |
] |
| 953 |
); |
| 954 |
|
| 955 |
$section_success_message->typographySection( |
| 956 |
__('Typography', 'fluentform'), |
| 957 |
'.ff-message-success, .ff-message-success p', |
| 958 |
$this |
| 959 |
); |
| 960 |
$section_success_message->borderSection(__('Border', 'fluentform'), '.ff-message-success', $this); |
| 961 |
$section_success_message->boxShadowSection(__('Box Shadow', 'fluentform'), '.ff-message-success', $this); |
| 962 |
|
| 963 |
$section_success_message->addPreset( |
| 964 |
'padding', |
| 965 |
'fluentform_success_message_padding', |
| 966 |
__('Padding', 'fluentform'), |
| 967 |
'.ff-message-success' |
| 968 |
)->whiteList(); |
| 969 |
} |
| 970 |
|
| 971 |
public function errorMessageStyle() |
| 972 |
{ |
| 973 |
$section_error_message = $this->addControlSection( |
| 974 |
'fluentform_error_message', |
| 975 |
__('Validation Error', 'fluentform'), |
| 976 |
'assets/icon.png', |
| 977 |
$this |
| 978 |
); |
| 979 |
$section_error_message->addStyleControls( |
| 980 |
[ |
| 981 |
[ |
| 982 |
'name' => __('Text Color', 'fluentform'), |
| 983 |
'selector' => '.ff-el-is-error .text-danger', |
| 984 |
'property' => 'color', |
| 985 |
'value' => '#f56c6c', |
| 986 |
], |
| 987 |
[ |
| 988 |
'selector' => '.ff-el-is-error .text-danger', |
| 989 |
'property' => 'font-size', |
| 990 |
'value' => 14, |
| 991 |
], |
| 992 |
[ |
| 993 |
'selector' => '.ff-el-is-error .text-danger', |
| 994 |
'property' => 'font-weight', |
| 995 |
], |
| 996 |
[ |
| 997 |
'selector' => '.ff-el-is-error .text-danger', |
| 998 |
'property' => 'margin-top', |
| 999 |
'value' => 4, |
| 1000 |
], |
| 1001 |
] |
| 1002 |
); |
| 1003 |
} |
| 1004 |
} |
| 1005 |
|
| 1006 |
new OxyFluentFormWidget(); |
| 1007 |
|