| 1 |
<?php |
| 2 |
namespace ABlocks\Blocks\FormBuilder; |
| 3 |
|
| 4 |
use ABlocks\Controls\Alignment; |
| 5 |
use ABlocks\Controls\Typography; |
| 6 |
use ABlocks\Controls\Range; |
| 7 |
use ABlocks\Controls\Border; |
| 8 |
use ABlocks\Controls\Dimensions; |
| 9 |
use ABlocks\Controls\Link; |
| 10 |
use ABlocks\Components\ButtonGroup; |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
$attributes = [ |
| 17 |
'block_id' => array( |
| 18 |
'type' => 'string', |
| 19 |
'default' => '' |
| 20 |
), |
| 21 |
'email_list_id' => array( |
| 22 |
'type' => 'string', |
| 23 |
'default' => '' |
| 24 |
), |
| 25 |
'blockVersion' => array( |
| 26 |
'type' => 'number', |
| 27 |
'default' => '', |
| 28 |
), |
| 29 |
'variationSelected' => [ |
| 30 |
'type' => 'boolean', |
| 31 |
'default' => true, |
| 32 |
], |
| 33 |
'postId' => [ |
| 34 |
'type' => 'number', |
| 35 |
'default' => '', |
| 36 |
], |
| 37 |
'email_template_id' => [ |
| 38 |
'type' => 'string', |
| 39 |
'default' => '', |
| 40 |
], |
| 41 |
'showLabels' => [ |
| 42 |
'type' => 'boolean', |
| 43 |
'default' => true |
| 44 |
], |
| 45 |
'subscriberToUser' => [ |
| 46 |
'type' => 'boolean', |
| 47 |
'default' => false |
| 48 |
], |
| 49 |
'adminNotify' => [ |
| 50 |
'type' => 'boolean', |
| 51 |
'default' => true |
| 52 |
], |
| 53 |
'loginRedirect' => [ |
| 54 |
'type' => 'boolean', |
| 55 |
'default' => false |
| 56 |
], |
| 57 |
'registerRedirect' => [ |
| 58 |
'type' => 'boolean', |
| 59 |
'default' => false |
| 60 |
], |
| 61 |
'navigatorAccess' => [ |
| 62 |
'type' => 'boolean', |
| 63 |
'default' => false |
| 64 |
], |
| 65 |
'formName' => array( |
| 66 |
'type' => 'string', |
| 67 |
'default' => '' |
| 68 |
), |
| 69 |
'formType' => array( |
| 70 |
'type' => 'string', |
| 71 |
'default' => '' |
| 72 |
), |
| 73 |
'formActions' => array( |
| 74 |
'type' => 'array', |
| 75 |
'default' => [] |
| 76 |
), |
| 77 |
'childDetails' => array( |
| 78 |
'type' => 'array', |
| 79 |
'default' => [] |
| 80 |
), |
| 81 |
'labelColor' => [ |
| 82 |
'type' => 'string', |
| 83 |
'default' => '#000000' |
| 84 |
], |
| 85 |
'helperTextColor' => [ |
| 86 |
'type' => 'string', |
| 87 |
'default' => '' |
| 88 |
], |
| 89 |
'customForm' => [ |
| 90 |
'type' => 'boolean', |
| 91 |
'default' => false |
| 92 |
], |
| 93 |
'inputColor' => [ |
| 94 |
'type' => 'string', |
| 95 |
'default' => '' |
| 96 |
], |
| 97 |
'inputBgColor' => [ |
| 98 |
'type' => 'string', |
| 99 |
'default' => 'white' |
| 100 |
], |
| 101 |
'inputPlaceholderColor' => [ |
| 102 |
'type' => 'string', |
| 103 |
'default' => '' |
| 104 |
], |
| 105 |
'buttonSize' => [ |
| 106 |
'type' => 'string', |
| 107 |
'default' => 'full-width' |
| 108 |
], |
| 109 |
'buttonColor' => [ |
| 110 |
'type' => 'string', |
| 111 |
'default' => '' |
| 112 |
], |
| 113 |
'buttonBgColor' => [ |
| 114 |
'type' => 'string', |
| 115 |
'default' => '' |
| 116 |
], |
| 117 |
'buttonHColor' => [ |
| 118 |
'type' => 'string', |
| 119 |
'default' => '' |
| 120 |
], |
| 121 |
'buttonBgHColor' => [ |
| 122 |
'type' => 'string', |
| 123 |
'default' => '' |
| 124 |
], |
| 125 |
'buttonText' => [ |
| 126 |
'type' => 'string', |
| 127 |
'default' => 'Submit Here', |
| 128 |
], |
| 129 |
// email One settings |
| 130 |
'emailOneTo' => [ |
| 131 |
'type' => 'string', |
| 132 |
'default' => '' |
| 133 |
], |
| 134 |
'emailOneSubject' => [ |
| 135 |
'type' => 'string', |
| 136 |
'default' => 'New message' |
| 137 |
], |
| 138 |
'emailOneMessage' => [ |
| 139 |
'type' => 'string', |
| 140 |
'default' => '{all-fields}' |
| 141 |
], |
| 142 |
'emailOneFormEmail' => [ |
| 143 |
'type' => 'string', |
| 144 |
'default' => '' |
| 145 |
], |
| 146 |
'emailOneFormName' => [ |
| 147 |
'type' => 'string', |
| 148 |
'default' => 'Local Name' |
| 149 |
], |
| 150 |
'emailOneReplyTo' => [ |
| 151 |
'type' => 'string', |
| 152 |
'default' => '' |
| 153 |
], |
| 154 |
'emailOneCc' => [ |
| 155 |
'type' => 'string', |
| 156 |
'default' => '' |
| 157 |
], |
| 158 |
'emailOneBcc' => [ |
| 159 |
'type' => 'string', |
| 160 |
'default' => '' |
| 161 |
], |
| 162 |
'emailOneType' => [ |
| 163 |
'type' => 'string', |
| 164 |
'default' => 'HTML' |
| 165 |
], |
| 166 |
// email two settings |
| 167 |
'emailTwoTo' => [ |
| 168 |
'type' => 'string', |
| 169 |
'default' => '' |
| 170 |
], |
| 171 |
'emailTwoSubject' => [ |
| 172 |
'type' => 'string', |
| 173 |
'default' => 'New message' |
| 174 |
], |
| 175 |
'emailTwoMessage' => [ |
| 176 |
'type' => 'string', |
| 177 |
'default' => '{all-fields}' |
| 178 |
], |
| 179 |
'emailTwoFormEmail' => [ |
| 180 |
'type' => 'string', |
| 181 |
'default' => '' |
| 182 |
], |
| 183 |
'emailTwoFormName' => [ |
| 184 |
'type' => 'string', |
| 185 |
'default' => 'Local Name' |
| 186 |
], |
| 187 |
'emailTwoReplyTo' => [ |
| 188 |
'type' => 'string', |
| 189 |
'default' => '' |
| 190 |
], |
| 191 |
'emailTwoCc' => [ |
| 192 |
'type' => 'string', |
| 193 |
'default' => '' |
| 194 |
], |
| 195 |
'emailTwoBcc' => [ |
| 196 |
'type' => 'string', |
| 197 |
'default' => '' |
| 198 |
], |
| 199 |
'emailTwoType' => [ |
| 200 |
'type' => 'string', |
| 201 |
'default' => 'HTML' |
| 202 |
], |
| 203 |
// mailchimp |
| 204 |
'mailchimpOption' => [ |
| 205 |
'type' => 'string', |
| 206 |
'default' => 'default' |
| 207 |
], |
| 208 |
|
| 209 |
'mailchimpApiKey' => [ |
| 210 |
'type' => 'string', |
| 211 |
'default' => '' |
| 212 |
], |
| 213 |
'mailchimpValidateApi' => [ |
| 214 |
'type' => 'boolean', |
| 215 |
'default' => false, |
| 216 |
], |
| 217 |
'mailchimpListIdOptions' => [ |
| 218 |
'type' => 'array', |
| 219 |
'default' => [ |
| 220 |
[ |
| 221 |
'label' => 'select options', |
| 222 |
'value' => 'default', |
| 223 |
] |
| 224 |
] |
| 225 |
], |
| 226 |
'mailchimpMapFields' => [ |
| 227 |
'type' => 'array', |
| 228 |
'default' => [] |
| 229 |
], |
| 230 |
'mailchimpMapSelects' => [ |
| 231 |
'type' => 'object', |
| 232 |
], |
| 233 |
'mailchimpListId' => [ |
| 234 |
'type' => 'string', |
| 235 |
'default' => 'default' |
| 236 |
], |
| 237 |
'mailchimpgroupsOptions' => [ |
| 238 |
'type' => 'array', |
| 239 |
'default' => [] |
| 240 |
], |
| 241 |
'mailchimpgroupSelects' => [ |
| 242 |
'type' => 'array', |
| 243 |
'default' => [] |
| 244 |
], |
| 245 |
'mailchimpTags' => [ |
| 246 |
'type' => 'string', |
| 247 |
'default' => '' |
| 248 |
], |
| 249 |
'mapEmailOptions' => [ |
| 250 |
'type' => 'array', |
| 251 |
'default' => [ |
| 252 |
[ |
| 253 |
'label' => 'None', |
| 254 |
'value' => 'default' |
| 255 |
] |
| 256 |
] |
| 257 |
], |
| 258 |
'mailchimpEmailSelects' => [ |
| 259 |
'type' => 'string', |
| 260 |
'default' => 'default' |
| 261 |
], |
| 262 |
'mapOtherOptions' => [ |
| 263 |
'type' => 'array', |
| 264 |
'default' => [ |
| 265 |
[ |
| 266 |
'label' => 'None', |
| 267 |
'value' => 'default' |
| 268 |
] |
| 269 |
] |
| 270 |
], |
| 271 |
'showDoubleOpt' => [ |
| 272 |
'type' => 'boolean', |
| 273 |
'default' => false |
| 274 |
], |
| 275 |
'mailchimpStatus' => [ |
| 276 |
'type' => 'string', |
| 277 |
'default' => '' |
| 278 |
], |
| 279 |
|
| 280 |
// mailerlite attributes |
| 281 |
'mailerliteOption' => [ |
| 282 |
'type' => 'string', |
| 283 |
'default' => 'default' |
| 284 |
], |
| 285 |
|
| 286 |
'mailerliteApiKey' => [ |
| 287 |
'type' => 'string', |
| 288 |
'default' => '' |
| 289 |
], |
| 290 |
'mailerliteValidateApi' => [ |
| 291 |
'type' => 'boolean', |
| 292 |
'default' => false, |
| 293 |
], |
| 294 |
'mailerliteGroupId' => [ |
| 295 |
'type' => 'string', |
| 296 |
'default' => 'default' |
| 297 |
], |
| 298 |
'mailerliteGroupIdOptions' => [ |
| 299 |
'type' => 'array', |
| 300 |
'default' => [ |
| 301 |
[ |
| 302 |
'label' => 'select options', |
| 303 |
'value' => 'default', |
| 304 |
] |
| 305 |
] |
| 306 |
], |
| 307 |
'mailerliteMapFields' => [ |
| 308 |
'type' => 'array', |
| 309 |
'default' => [] |
| 310 |
], |
| 311 |
'mailerliteMapSelects' => [ |
| 312 |
'type' => 'object' |
| 313 |
], |
| 314 |
'allowReSubscribe' => [ |
| 315 |
'type' => 'boolean', |
| 316 |
'default' => false |
| 317 |
], |
| 318 |
|
| 319 |
// drip attributes |
| 320 |
'dripOption' => [ |
| 321 |
'type' => 'string', |
| 322 |
'default' => 'default' |
| 323 |
], |
| 324 |
|
| 325 |
'dripApiKey' => [ |
| 326 |
'type' => 'string', |
| 327 |
'default' => '' |
| 328 |
], |
| 329 |
'dripValidateApi' => [ |
| 330 |
'type' => 'boolean', |
| 331 |
'default' => false, |
| 332 |
], |
| 333 |
'dripAccountIdOptions' => [ |
| 334 |
'type' => 'array', |
| 335 |
'default' => [ |
| 336 |
[ |
| 337 |
'label' => 'select options', |
| 338 |
'value' => 'default' |
| 339 |
] |
| 340 |
] |
| 341 |
], |
| 342 |
'dripAccountId' => [ |
| 343 |
'type' => 'string', |
| 344 |
'default' => 'default' |
| 345 |
], |
| 346 |
'dripMapFields' => [ |
| 347 |
'type' => 'array', |
| 348 |
'default' => [] |
| 349 |
], |
| 350 |
'dripMapSelects' => [ |
| 351 |
'type' => 'object' |
| 352 |
], |
| 353 |
'dripEmailSelects' => [ |
| 354 |
'type' => 'string', |
| 355 |
'default' => 'default' |
| 356 |
], |
| 357 |
'dripTags' => [ |
| 358 |
'type' => 'string', |
| 359 |
'default' => '' |
| 360 |
], |
| 361 |
'showFormFields' => [ |
| 362 |
'type' => 'boolean', |
| 363 |
'default' => false |
| 364 |
], |
| 365 |
|
| 366 |
// getResponse attributes |
| 367 |
'getResponseOption' => [ |
| 368 |
'type' => 'string', |
| 369 |
'default' => 'default' |
| 370 |
], |
| 371 |
|
| 372 |
'getResponseApiKey' => [ |
| 373 |
'type' => 'string', |
| 374 |
'default' => '' |
| 375 |
], |
| 376 |
'getResponseValidateApi' => [ |
| 377 |
'type' => 'boolean', |
| 378 |
'default' => false, |
| 379 |
], |
| 380 |
'getResponseListId' => [ |
| 381 |
'type' => 'string', |
| 382 |
'default' => 'default' |
| 383 |
], |
| 384 |
'getResponseListIdOptions' => [ |
| 385 |
'type' => 'array', |
| 386 |
'default' => [ |
| 387 |
[ |
| 388 |
'label' => 'select options', |
| 389 |
'value' => 'default' |
| 390 |
] |
| 391 |
] |
| 392 |
], |
| 393 |
'getResponseMapFields' => [ |
| 394 |
'type' => 'array', |
| 395 |
'default' => [] |
| 396 |
], |
| 397 |
'getResponseMapSelects' => [ |
| 398 |
'type' => 'object' |
| 399 |
], |
| 400 |
'getResponseDayCycle' => [ |
| 401 |
'type' => 'number', |
| 402 |
'default' => 1, |
| 403 |
], |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
// getResponse attributes |
| 408 |
'convertkitOption' => [ |
| 409 |
'type' => 'string', |
| 410 |
'default' => 'default' |
| 411 |
], |
| 412 |
|
| 413 |
'convertkitApiKey' => [ |
| 414 |
'type' => 'string', |
| 415 |
'default' => '' |
| 416 |
], |
| 417 |
'convertkitValidateApi' => [ |
| 418 |
'type' => 'boolean', |
| 419 |
'default' => false, |
| 420 |
], |
| 421 |
'convertkitFormId' => [ |
| 422 |
'type' => 'string', |
| 423 |
'default' => 'default' |
| 424 |
], |
| 425 |
'convertkitFormIdOptions' => [ |
| 426 |
'type' => 'array', |
| 427 |
'default' => [ |
| 428 |
[ |
| 429 |
'label' => 'select options', |
| 430 |
'value' => 'default', |
| 431 |
] |
| 432 |
] |
| 433 |
], |
| 434 |
'convertkitMapFields' => [ |
| 435 |
'type' => 'array', |
| 436 |
'default' => [] |
| 437 |
], |
| 438 |
'convertkitMapSelects' => [ |
| 439 |
'type' => 'object' |
| 440 |
], |
| 441 |
'convertkitEmailSelects' => [ |
| 442 |
'type' => 'string', |
| 443 |
'default' => 'default' |
| 444 |
], |
| 445 |
'convertkitFirstNameSelects' => [ |
| 446 |
'type' => 'string', |
| 447 |
'default' => 'default' |
| 448 |
], |
| 449 |
'convertkitTagsOptions' => [ |
| 450 |
'type' => 'array', |
| 451 |
'default' => [] |
| 452 |
], |
| 453 |
'convertkitTagsSelects' => [ |
| 454 |
'type' => 'array', |
| 455 |
'default' => [] |
| 456 |
], |
| 457 |
'emailVerification' => [ |
| 458 |
'type' => 'boolean', |
| 459 |
'default' => false |
| 460 |
], |
| 461 |
'submissionMetaData' => [ |
| 462 |
'type' => 'array', |
| 463 |
'default' => [] |
| 464 |
], |
| 465 |
'navigatorColor' => [ |
| 466 |
'type' => 'string', |
| 467 |
'default' => '#74777C' |
| 468 |
], |
| 469 |
'navigatorIcon' => [ |
| 470 |
'type' => 'object', |
| 471 |
'default' => [ |
| 472 |
'viewBox' => '0 0 448 512', |
| 473 |
'path' => 'M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z' |
| 474 |
], |
| 475 |
], |
| 476 |
'navigatorIconShow' => [ |
| 477 |
'type' => 'boolean', |
| 478 |
'default' => true |
| 479 |
], |
| 480 |
'forgetPasswordLabel' => array( |
| 481 |
'type' => 'string', |
| 482 |
'default' => 'Lost Your Password', |
| 483 |
), |
| 484 |
'loginLabel' => array( |
| 485 |
'type' => 'string', |
| 486 |
'default' => 'Log in', |
| 487 |
), |
| 488 |
'registerLabel' => array( |
| 489 |
'type' => 'string', |
| 490 |
'default' => 'Register', |
| 491 |
), |
| 492 |
'homeLabel' => array( |
| 493 |
'type' => 'string', |
| 494 |
'default' => 'Go to home', |
| 495 |
), |
| 496 |
'errorBackground' => array( |
| 497 |
'type' => 'string', |
| 498 |
'default' => '#D03739' |
| 499 |
), |
| 500 |
'errorColor' => array( |
| 501 |
'type' => 'string', |
| 502 |
'default' => '#ffffff' |
| 503 |
), |
| 504 |
'successColor' => array( |
| 505 |
'type' => 'string', |
| 506 |
'default' => '#fffff' |
| 507 |
), |
| 508 |
'successBackground' => array( |
| 509 |
'type' => 'string', |
| 510 |
'default' => '#00935B' |
| 511 |
), |
| 512 |
'showErrorDemo' => [ |
| 513 |
'type' => 'boolean', |
| 514 |
'default' => false, |
| 515 |
], |
| 516 |
'showSuccessDemo' => [ |
| 517 |
'type' => 'boolean', |
| 518 |
'default' => false, |
| 519 |
], |
| 520 |
'userRoles' => [ |
| 521 |
'type' => 'array', |
| 522 |
'default' => [] |
| 523 |
], |
| 524 |
'roleSlug' => [ |
| 525 |
'type' => 'string', |
| 526 |
'default' => '', |
| 527 |
], |
| 528 |
'confirmationNotice' => [ |
| 529 |
'type' => 'string', |
| 530 |
'default' => 'Form successfully submitted!' |
| 531 |
|
| 532 |
], |
| 533 |
'afterFormSubmission' => [ |
| 534 |
'type' => 'string', |
| 535 |
'default' => 'reset' |
| 536 |
|
| 537 |
], |
| 538 |
'customUrl' => [ |
| 539 |
'type' => 'string', |
| 540 |
'default' => '' |
| 541 |
|
| 542 |
], |
| 543 |
'confirmationType' => [ |
| 544 |
'type' => 'string', |
| 545 |
'default' => 'success' |
| 546 |
|
| 547 |
], |
| 548 |
]; |
| 549 |
$attributes = array_merge( |
| 550 |
$attributes, |
| 551 |
Alignment::get_attribute( 'labelAlignment', true, [ 'value' => 'left' ] ), |
| 552 |
Alignment::get_attribute( 'inputAlignment', true, [ 'value' => 'left' ] ), |
| 553 |
Alignment::get_attribute( 'buttonTextAlignment', true, [ 'value' => 'center' ] ), |
| 554 |
Alignment::get_attribute( 'navigatorAlignment', true, [ 'value' => 'left' ] ), |
| 555 |
Alignment::get_attribute( 'buttonAlignment', true, [ 'value' => 'center' ] ), |
| 556 |
Alignment::get_attribute( 'successErrorAlignment', true, [ 'value' => 'center' ] ), |
| 557 |
Range::get_attribute( [ |
| 558 |
'attributeName' => 'rowsSpacing', |
| 559 |
'attributeObjectKey' => 'value', |
| 560 |
'isResponsive' => true, |
| 561 |
'defaultValue' => 0, |
| 562 |
] ), |
| 563 |
Range::get_attribute( [ |
| 564 |
'attributeName' => 'buttonHeight', |
| 565 |
'attributeObjectKey' => 'value', |
| 566 |
'isResponsive' => true, |
| 567 |
'defaultValue' => 0, |
| 568 |
'hasUnit' => true, |
| 569 |
'unitDefaultValue' => 'px', |
| 570 |
] ), |
| 571 |
Range::get_attribute( [ |
| 572 |
'attributeName' => 'labelSpacing', |
| 573 |
'attributeObjectKey' => 'value', |
| 574 |
'isResponsive' => true, |
| 575 |
'defaultValue' => 10, |
| 576 |
] ), |
| 577 |
Range::get_attribute( [ |
| 578 |
'attributeName' => 'helperTextSpacing', |
| 579 |
'attributeObjectKey' => 'value', |
| 580 |
'isResponsive' => true, |
| 581 |
'defaultValue' => 10, |
| 582 |
] ), |
| 583 |
Range::get_attribute( [ |
| 584 |
'attributeName' => 'inputIconPosition', |
| 585 |
'attributeObjectKey' => 'value', |
| 586 |
'isResponsive' => false, |
| 587 |
'defaultValue' => 75, |
| 588 |
] ), |
| 589 |
Range::get_attribute( [ |
| 590 |
'attributeName' => 'navigatorSpacing', |
| 591 |
'attributeObjectKey' => 'value', |
| 592 |
'isResponsive' => false, |
| 593 |
'defaultValue' => 10, |
| 594 |
] ), |
| 595 |
Link::get_attribute( 'link' ), |
| 596 |
Link::get_attribute( 'webhookLink' ), |
| 597 |
Typography::get_attribute( 'labelTypography', true ), |
| 598 |
Typography::get_attribute( 'helperTextTypography', true ), |
| 599 |
Typography::get_attribute( 'inputTypography', true ), |
| 600 |
Typography::get_attribute( 'buttonTypography', true ), |
| 601 |
Typography::get_attribute( 'navigatorTypography', true ), |
| 602 |
Typography::get_attribute( 'successErrorTypography', true ), |
| 603 |
Border::get_attribute( 'inputBorder', true ), |
| 604 |
Border::get_attribute( 'buttonBorder', true ), |
| 605 |
Dimensions::get_attribute( 'inputPadding', true ), |
| 606 |
Dimensions::get_attribute( 'navigatorPadding', true ), |
| 607 |
Dimensions::get_attribute( 'successErrorPadding', true ), |
| 608 |
Dimensions::get_attribute( 'buttonPadding', true ), |
| 609 |
ButtonGroup::get_attribute( 'dir', true, [ |
| 610 |
'value' => 'column', |
| 611 |
] ), |
| 612 |
); |
| 613 |
|
| 614 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 615 |
|
| 616 |
|