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