module-form-action-custom.php
9 months ago
module-form-action-email.php
1 week ago
module-form-action-post.php
3 months ago
module-form-action-redirect.php
9 months ago
module-form-action-term.php
3 months ago
module-form-action-user.php
1 week ago
module-form-action.php
3 months ago
module-form-compatibility.php
3 months ago
module-form-deprecated.php
1 year ago
module-form-fields.php
3 months ago
module-form-front-hooks.php
3 months ago
module-form-front-render.php
1 week ago
module-form-front.php
3 months ago
module-form-shortcode.php
1 week ago
module-form-upgrades.php
3 months ago
module-form.php
3 months ago
module-form-front-render.php
732 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')){ |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | if(!class_exists('acfe_module_form_front_render')): |
| 8 | |
| 9 | class acfe_module_form_front_render{ |
| 10 | |
| 11 | /** |
| 12 | * __construct |
| 13 | */ |
| 14 | function __construct(){ |
| 15 | // ... |
| 16 | } |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * form_render_success |
| 21 | * |
| 22 | * acfe/form/render_success |
| 23 | * |
| 24 | * @param $form |
| 25 | */ |
| 26 | function render_success($form){ |
| 27 | |
| 28 | // get message |
| 29 | $message = $form['success']['message']; |
| 30 | |
| 31 | // success message |
| 32 | if($message){ |
| 33 | |
| 34 | // flag |
| 35 | $shortcode_disabled = false; |
| 36 | |
| 37 | // check if shortcodes should be disabled |
| 38 | // and check if acf_the_content has do_shortcode filter |
| 39 | if(empty($form['success']['shortcode']) && has_filter('acf_the_content', 'do_shortcode', 11)){ |
| 40 | |
| 41 | $shortcode_disabled = true; // set flag |
| 42 | remove_filter('acf_the_content', 'do_shortcode', 11); |
| 43 | |
| 44 | } |
| 45 | |
| 46 | // apply the_content filters (autop, shortcode, etc.) |
| 47 | $message = apply_filters('acf_the_content', $message); |
| 48 | |
| 49 | // re-add shortcode filter |
| 50 | if($shortcode_disabled){ |
| 51 | add_filter('acf_the_content', 'do_shortcode', 11); |
| 52 | } |
| 53 | |
| 54 | // html message |
| 55 | if($form['success']['wrapper']){ |
| 56 | $message = acfe_str_replace($form['success']['wrapper'], '%s', $message, 0, 1, true); |
| 57 | } |
| 58 | |
| 59 | echo $message; |
| 60 | |
| 61 | } |
| 62 | |
| 63 | // add localize data |
| 64 | acfe_set_form_data($form, 'success', true); |
| 65 | |
| 66 | $data = array(); |
| 67 | $data = apply_filters("acfe/form/submit_success_data", $data, $form); |
| 68 | $data = apply_filters("acfe/form/submit_success_data/form={$form['name']}", $data, $form); |
| 69 | |
| 70 | // add success data |
| 71 | acfe_set_form_data($form, 'success_data', $data); |
| 72 | |
| 73 | // scroll to message |
| 74 | if($form['success']['scroll']){ |
| 75 | |
| 76 | // message exists |
| 77 | if(!empty($form['success']['message']) && !empty($form['success']['wrapper'])){ |
| 78 | |
| 79 | // get css selector |
| 80 | $selector = $this->get_css_selector_from_string($form['success']['wrapper']); |
| 81 | |
| 82 | // add selector |
| 83 | if(!empty($selector)){ |
| 84 | acfe_set_form_data($form, 'selector', $selector); |
| 85 | } |
| 86 | |
| 87 | } |
| 88 | |
| 89 | } |
| 90 | |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /** |
| 95 | * prepare_form |
| 96 | * |
| 97 | * acfe/form/prepare_form |
| 98 | * |
| 99 | * @param $form |
| 100 | * |
| 101 | * @return mixed |
| 102 | */ |
| 103 | function prepare_form($form){ |
| 104 | |
| 105 | if(!$form){ |
| 106 | return false; |
| 107 | } |
| 108 | |
| 109 | // field values |
| 110 | // we must inject values earlier than 10 so custom check in acf/prepare_field can be done |
| 111 | // this fix an issue with Select 'custom value' which is checked on acf/prepare_field/type=select |
| 112 | add_filter('acf/prepare_field', array($this, 'prepare_field_values'), 9); |
| 113 | |
| 114 | // field settings |
| 115 | add_filter('acf/prepare_field', array($this, 'prepare_field_settings'), 15); |
| 116 | |
| 117 | // field attributes |
| 118 | add_filter('acf/prepare_field', array($this, 'prepare_field_attributes'), 15); |
| 119 | |
| 120 | // uploader (always set in case of multiple forms on the page) |
| 121 | acf_disable_filter('acfe/form/uploader'); |
| 122 | |
| 123 | if($form['settings']['uploader'] !== 'default'){ |
| 124 | |
| 125 | acf_enable_filter('acfe/form/uploader'); |
| 126 | acf_update_setting('uploader', $form['settings']['uploader']); |
| 127 | |
| 128 | } |
| 129 | |
| 130 | // custom instruction placement |
| 131 | acf_enable_filter('acfe/override_instruction'); |
| 132 | acf_disable_filter('acfe/instruction_tooltip'); |
| 133 | acf_disable_filter('acfe/instruction_above_field'); |
| 134 | |
| 135 | if($form['attributes']['fields']['instruction'] === 'tooltip'){ |
| 136 | acf_enable_filter('acfe/instruction_tooltip'); |
| 137 | }elseif($form['attributes']['fields']['instruction'] === 'above_field'){ |
| 138 | acf_enable_filter('acfe/instruction_above_field'); |
| 139 | } |
| 140 | |
| 141 | // generate render |
| 142 | if($form['render']){ |
| 143 | |
| 144 | // added mapped fields to context |
| 145 | // this allow {render:field_name} to first check fields of the mapped field groups |
| 146 | $mapped_fields = $this->get_form_fields_keys($form); |
| 147 | acfe_add_context('mapped_fields', $mapped_fields); |
| 148 | |
| 149 | // check if render has {render:submit} tag |
| 150 | $has_render_submit = false; |
| 151 | |
| 152 | // array render |
| 153 | if(is_array($form['render'])){ |
| 154 | |
| 155 | $html = array_map(function($row){ |
| 156 | return "{render:$row}"; |
| 157 | }, $form['render']); |
| 158 | |
| 159 | $html = implode('', $html); |
| 160 | |
| 161 | // assign new render |
| 162 | $form['render'] = $html; |
| 163 | |
| 164 | } |
| 165 | |
| 166 | // check render |
| 167 | if(is_string($form['render'])){ |
| 168 | |
| 169 | // check {render:submit} exists |
| 170 | if(strpos($form['render'], '{render:submit}') !== false){ |
| 171 | $has_render_submit = true; |
| 172 | } |
| 173 | |
| 174 | } |
| 175 | |
| 176 | // parse template tags |
| 177 | $form['render'] = acfe_parse_tags($form['render'], array('context' => 'display')); |
| 178 | |
| 179 | // render is empty even after tags parsing |
| 180 | // we must set it to true to render nothing |
| 181 | // and avoid rendering default field group |
| 182 | if(empty($form['render'])){ |
| 183 | $form['render'] = true; |
| 184 | } |
| 185 | |
| 186 | // render has the {render:submit} tag |
| 187 | // disallow default submit button after the form render |
| 188 | if($has_render_submit){ |
| 189 | $form['attributes']['submit'] = false; |
| 190 | } |
| 191 | |
| 192 | } |
| 193 | |
| 194 | // flexible content dynamic preview |
| 195 | if(acfe_is_dynamic_preview()){ |
| 196 | $form['attributes']['form']['element'] = 'div'; |
| 197 | } |
| 198 | |
| 199 | return $form; |
| 200 | |
| 201 | } |
| 202 | |
| 203 | |
| 204 | /** |
| 205 | * render_before_form |
| 206 | * |
| 207 | * acfe/form/render_before_form |
| 208 | * |
| 209 | * @param $form |
| 210 | */ |
| 211 | function render_before_form($form){ |
| 212 | |
| 213 | // atts |
| 214 | $atts = array( |
| 215 | 'method' => 'post', |
| 216 | 'class' => 'acfe-form', |
| 217 | 'data-cid' => $form['cid'], |
| 218 | ); |
| 219 | |
| 220 | // form class |
| 221 | if($form['attributes']['form']['class']){ |
| 222 | $atts['class'] .= ' ' . $form['attributes']['form']['class']; |
| 223 | } |
| 224 | |
| 225 | // form id |
| 226 | if($form['attributes']['form']['id']){ |
| 227 | $atts['id'] = $form['attributes']['form']['id']; |
| 228 | } |
| 229 | |
| 230 | $element = $form['attributes']['form']['element']; |
| 231 | |
| 232 | // validate element |
| 233 | if(!in_array($element, array('form', 'div'))){ |
| 234 | $element = 'form'; |
| 235 | } |
| 236 | |
| 237 | // unset method & action for <div> element |
| 238 | if($element === 'div'){ |
| 239 | unset($atts['method']); |
| 240 | } |
| 241 | |
| 242 | // filters |
| 243 | $atts = apply_filters("acfe/form/render_form_atts", $atts, $form); |
| 244 | $atts = apply_filters("acfe/form/render_form_atts/form={$form['name']}", $atts, $form); |
| 245 | |
| 246 | // esc atts |
| 247 | $atts = acf_esc_attrs($atts); |
| 248 | |
| 249 | // <form class="acfe-form"> |
| 250 | echo "<{$element} {$atts}>"; |
| 251 | |
| 252 | // form data |
| 253 | // do not set form data in preview mode |
| 254 | if(!acfe_is_dynamic_preview()){ |
| 255 | |
| 256 | acf_form_data(array( |
| 257 | 'screen' => 'acfe_form', |
| 258 | 'post_id' => $form['post_id'], |
| 259 | 'form' => acf_encrypt(json_encode($form)) |
| 260 | )); |
| 261 | |
| 262 | } |
| 263 | |
| 264 | } |
| 265 | |
| 266 | |
| 267 | /** |
| 268 | * render_before_fields |
| 269 | * |
| 270 | * acfe/form/render_before_fields |
| 271 | * |
| 272 | * @param $form |
| 273 | */ |
| 274 | function render_before_fields($form){ |
| 275 | |
| 276 | /** |
| 277 | * fields wrapper open |
| 278 | */ |
| 279 | $atts = array('class' => 'acf-fields acf-form-fields'); |
| 280 | |
| 281 | if($form['attributes']['fields']['label'] !== 'hidden'){ |
| 282 | $atts['class'] .= " -{$form['attributes']['fields']['label']}"; |
| 283 | } |
| 284 | |
| 285 | $atts = acf_esc_attrs($atts); |
| 286 | |
| 287 | // <div class="acf-fields acf-form-fields"> |
| 288 | echo "<div {$atts}>"; |
| 289 | |
| 290 | } |
| 291 | |
| 292 | |
| 293 | /** |
| 294 | * render_fields |
| 295 | * |
| 296 | * acfe/form/render_fields |
| 297 | * |
| 298 | * @param $form |
| 299 | */ |
| 300 | function render_fields($form){ |
| 301 | |
| 302 | // honeypot |
| 303 | // ACF automatically validate that field in: |
| 304 | // advanced-custom-fields-pro/includes/forms/form-front.php:218 |
| 305 | if($form['settings']['honeypot']){ |
| 306 | |
| 307 | // register local _validate_email |
| 308 | acf_add_local_field(array( |
| 309 | 'prefix' => 'acf', |
| 310 | 'name' => '_validate_email', |
| 311 | 'key' => '_validate_email', |
| 312 | 'label' => __('Validate Email', 'acf'), |
| 313 | 'type' => 'text', |
| 314 | 'value' => '', |
| 315 | 'wrapper' => array('style' => 'display:none !important;') |
| 316 | )); |
| 317 | |
| 318 | $honeypot = array(acf_get_field('_validate_email')); |
| 319 | acf_render_fields($honeypot, $form['uniqid'], $form['attributes']['fields']['element'], $form['attributes']['fields']['instruction']); |
| 320 | |
| 321 | } |
| 322 | |
| 323 | // custom render |
| 324 | if($form['render']){ |
| 325 | echo $form['render']; |
| 326 | |
| 327 | // default render |
| 328 | }else{ |
| 329 | |
| 330 | $fields = $this->get_allowed_fields($form); |
| 331 | acf_render_fields($fields, $form['uniqid'], $form['attributes']['fields']['element'], $form['attributes']['fields']['instruction']); |
| 332 | |
| 333 | } |
| 334 | |
| 335 | } |
| 336 | |
| 337 | |
| 338 | /** |
| 339 | * render_after_fields |
| 340 | * |
| 341 | * acfe/form/render_after_fields |
| 342 | * |
| 343 | * @param $form |
| 344 | */ |
| 345 | function render_after_fields($form){ |
| 346 | |
| 347 | /** |
| 348 | * fields wrapper close |
| 349 | */ |
| 350 | echo '</div>'; |
| 351 | |
| 352 | } |
| 353 | |
| 354 | |
| 355 | /** |
| 356 | * render_submit |
| 357 | * |
| 358 | * acfe/form/render_submit |
| 359 | * |
| 360 | * @param $form |
| 361 | */ |
| 362 | function render_submit($form){ |
| 363 | |
| 364 | // form submit |
| 365 | if($form['attributes']['submit']): ?> |
| 366 | <div class="acf-form-submit"> |
| 367 | |
| 368 | <?php printf($form['attributes']['submit']['button'], $form['attributes']['submit']['value']); ?> |
| 369 | <?php echo $form['attributes']['submit']['spinner']; ?> |
| 370 | |
| 371 | </div> |
| 372 | <?php endif; |
| 373 | |
| 374 | } |
| 375 | |
| 376 | |
| 377 | /** |
| 378 | * render_after_form |
| 379 | * |
| 380 | * acfe/form/render_after_form |
| 381 | * |
| 382 | * @param $form |
| 383 | */ |
| 384 | function render_after_form($form){ |
| 385 | |
| 386 | /** |
| 387 | * form wrapper close |
| 388 | */ |
| 389 | $element = $form['attributes']['form']['element']; |
| 390 | |
| 391 | // validate element |
| 392 | if(!in_array($element, array('form', 'div'))){ |
| 393 | $element = 'form'; |
| 394 | } |
| 395 | |
| 396 | // </form> |
| 397 | echo "</{$element}>"; |
| 398 | |
| 399 | // form is loaded in ajax |
| 400 | // append form data manually |
| 401 | if(acf_is_ajax() && !acfe_is_dynamic_preview()){ |
| 402 | |
| 403 | $data = array(); |
| 404 | $data = apply_filters("acfe/form/set_form_data", $data, $form); |
| 405 | $data = apply_filters("acfe/form/set_form_data/form={$form['name']}", $data, $form); |
| 406 | |
| 407 | if($data){ |
| 408 | ?> |
| 409 | <script type="text/javascript"> |
| 410 | (function($){ |
| 411 | if(typeof acf !== 'undefined' && typeof acfe !== 'undefined'){ |
| 412 | acfe.set('forms.<?php echo $form['cid']; ?>', <?php echo json_encode($data); ?>); |
| 413 | } |
| 414 | })(jQuery); |
| 415 | </script> |
| 416 | <?php |
| 417 | } |
| 418 | |
| 419 | } |
| 420 | |
| 421 | } |
| 422 | |
| 423 | |
| 424 | /** |
| 425 | * prepare_field_values |
| 426 | * |
| 427 | * acf/prepare_field:9 |
| 428 | * |
| 429 | * @param $field |
| 430 | * |
| 431 | * @return mixed |
| 432 | */ |
| 433 | function prepare_field_values($field){ |
| 434 | |
| 435 | // hidden by code |
| 436 | if(!$field){ |
| 437 | return $field; |
| 438 | } |
| 439 | |
| 440 | // get form context |
| 441 | $form = acfe_get_context('form'); |
| 442 | if(!$form){ |
| 443 | return $field; |
| 444 | } |
| 445 | |
| 446 | // mapping not set |
| 447 | if(!isset($form['map'][ $field['key'] ]['value'])){ |
| 448 | return $field; |
| 449 | } |
| 450 | |
| 451 | $field['value'] = $form['map'][ $field['key'] ]['value']; |
| 452 | |
| 453 | return $field; |
| 454 | |
| 455 | } |
| 456 | |
| 457 | |
| 458 | /** |
| 459 | * prepare_field_settings |
| 460 | * |
| 461 | * acf/prepare_field:15 |
| 462 | * |
| 463 | * @param $field |
| 464 | * |
| 465 | * @return mixed |
| 466 | */ |
| 467 | function prepare_field_settings($field){ |
| 468 | |
| 469 | // hidden by code |
| 470 | if(!$field){ |
| 471 | return $field; |
| 472 | } |
| 473 | |
| 474 | // get form context |
| 475 | $form = acfe_get_context('form'); |
| 476 | if(!$form){ |
| 477 | return $field; |
| 478 | } |
| 479 | |
| 480 | // mapping not set |
| 481 | if(!isset($form['map'][ $field['key'] ])){ |
| 482 | return $field; |
| 483 | } |
| 484 | |
| 485 | // hidden in mapping |
| 486 | if($form['map'][ $field['key'] ] === false){ |
| 487 | return false; |
| 488 | } |
| 489 | |
| 490 | // value already injected in prepare_field_values() |
| 491 | // we should not assign again the value, as it might be changed in acf/prepare_field/type=name |
| 492 | unset($form['map'][ $field['key'] ]['value']); |
| 493 | |
| 494 | // merge field settings |
| 495 | // form map takes priority over other rules in acf/prepare_field |
| 496 | $field = acfe_parse_args_r($form['map'][ $field['key'] ], $field); |
| 497 | |
| 498 | // merge |
| 499 | return $field; |
| 500 | |
| 501 | } |
| 502 | |
| 503 | |
| 504 | /** |
| 505 | * prepare_field_attributes |
| 506 | * |
| 507 | * acf/prepare_field:15 |
| 508 | * |
| 509 | * @param $field |
| 510 | * |
| 511 | * @return array|mixed |
| 512 | */ |
| 513 | function prepare_field_attributes($field){ |
| 514 | |
| 515 | // hidden by code |
| 516 | if(!$field){ |
| 517 | return $field; |
| 518 | } |
| 519 | |
| 520 | // get form context |
| 521 | $form = acfe_get_context('form'); |
| 522 | if(!$form){ |
| 523 | return $field; |
| 524 | } |
| 525 | |
| 526 | if($form['attributes']['fields']['wrapper_class']){ |
| 527 | $field['wrapper']['class'] .= ' ' . $form['attributes']['fields']['wrapper_class']; |
| 528 | } |
| 529 | |
| 530 | if($form['attributes']['fields']['class']){ |
| 531 | $field['class'] .= ' ' . $form['attributes']['fields']['class']; |
| 532 | } |
| 533 | |
| 534 | if($form['attributes']['fields']['label'] === 'hidden'){ |
| 535 | $field['label'] = false; |
| 536 | } |
| 537 | |
| 538 | // preview mode |
| 539 | if(acfe_is_dynamic_preview()){ |
| 540 | |
| 541 | $field['name'] = ''; |
| 542 | $field['required'] = false; |
| 543 | $field['value'] = null; |
| 544 | |
| 545 | } |
| 546 | |
| 547 | return $field; |
| 548 | |
| 549 | } |
| 550 | |
| 551 | |
| 552 | /** |
| 553 | * get_allowed_field_groups |
| 554 | * |
| 555 | * @param $form |
| 556 | * |
| 557 | * @return array |
| 558 | */ |
| 559 | function get_allowed_field_groups($form){ |
| 560 | |
| 561 | // vars |
| 562 | $field_groups = array(); |
| 563 | |
| 564 | // post field groups |
| 565 | // deprecated |
| 566 | if(acfe_get($form, 'post_field_groups')){ |
| 567 | |
| 568 | _deprecated_function('ACF Extended: "Post Field Groups" Form setting', '0.8.7.5'); |
| 569 | |
| 570 | // Override Field Groups |
| 571 | $post_field_groups = acf_get_field_groups(array( |
| 572 | 'post_id' => $form['post_field_groups'] |
| 573 | )); |
| 574 | |
| 575 | // re-assign post field groups |
| 576 | $form['field_groups'] = wp_list_pluck($post_field_groups, 'key'); |
| 577 | |
| 578 | } |
| 579 | |
| 580 | // form field groups |
| 581 | foreach($form['field_groups'] as $key){ |
| 582 | |
| 583 | // make sure field group exists |
| 584 | $field_group = acf_get_field_group($key); |
| 585 | |
| 586 | if($field_group){ |
| 587 | $field_groups[] = $field_group; |
| 588 | } |
| 589 | |
| 590 | } |
| 591 | |
| 592 | // apply field groups rules |
| 593 | if($field_groups && $form['settings']['location']){ |
| 594 | |
| 595 | $location = array( |
| 596 | 'post_id' => $form['post_id'], |
| 597 | 'post_type' => get_post_type($form['post_id']), |
| 598 | ); |
| 599 | |
| 600 | $filtered = array(); |
| 601 | |
| 602 | // loop |
| 603 | foreach($field_groups as $field_group){ |
| 604 | |
| 605 | // check field group is valid |
| 606 | if(isset($field_group['location'])){ |
| 607 | |
| 608 | // temporarly active field group for visibility check |
| 609 | $field_group['active'] = true; |
| 610 | |
| 611 | // fitler field group |
| 612 | if(acf_get_field_group_visibility($field_group, $location)){ |
| 613 | $filtered[] = $field_group; |
| 614 | } |
| 615 | |
| 616 | } |
| 617 | |
| 618 | } |
| 619 | |
| 620 | // assign new filtered field groups |
| 621 | $field_groups = $filtered; |
| 622 | |
| 623 | } |
| 624 | |
| 625 | // return |
| 626 | return $field_groups; |
| 627 | |
| 628 | } |
| 629 | |
| 630 | |
| 631 | /** |
| 632 | * get_allowed_fields |
| 633 | * |
| 634 | * @param $form |
| 635 | * |
| 636 | * @return array |
| 637 | */ |
| 638 | function get_allowed_fields($form){ |
| 639 | |
| 640 | // vars |
| 641 | $fields = array(); |
| 642 | |
| 643 | // get allowed field groups (filtered) |
| 644 | $field_groups = $this->get_allowed_field_groups($form); |
| 645 | |
| 646 | foreach($field_groups as $field_group){ |
| 647 | |
| 648 | $_fields = acf_get_fields($field_group); |
| 649 | |
| 650 | foreach(array_keys($_fields) as $i){ |
| 651 | $fields[] = acf_extract_var($_fields, $i); |
| 652 | } |
| 653 | |
| 654 | } |
| 655 | |
| 656 | return $fields; |
| 657 | |
| 658 | } |
| 659 | |
| 660 | |
| 661 | /** |
| 662 | * get_form_fields_keys |
| 663 | * |
| 664 | * Used to determine if the {render:field_name} is within mapped field groups |
| 665 | * |
| 666 | * @param $form |
| 667 | * |
| 668 | * @return array |
| 669 | */ |
| 670 | function get_form_fields_keys($form){ |
| 671 | |
| 672 | $results = array(); |
| 673 | |
| 674 | // form field groups |
| 675 | foreach($form['field_groups'] as $key){ |
| 676 | |
| 677 | // make sure field group exists |
| 678 | $field_group = acf_get_field_group($key); |
| 679 | |
| 680 | // found field group |
| 681 | if($field_group){ |
| 682 | |
| 683 | // get fields |
| 684 | $fields = acf_get_fields($field_group); |
| 685 | |
| 686 | // found fields |
| 687 | if(!empty($fields)){ |
| 688 | |
| 689 | // merge results |
| 690 | $results = array_merge($results, wp_list_pluck($fields, 'key', 'name')); |
| 691 | } |
| 692 | |
| 693 | } |
| 694 | |
| 695 | } |
| 696 | |
| 697 | return $results; |
| 698 | |
| 699 | } |
| 700 | |
| 701 | |
| 702 | /** |
| 703 | * get_css_selector_from_string |
| 704 | * |
| 705 | * @param $str |
| 706 | * |
| 707 | * @return string |
| 708 | */ |
| 709 | function get_css_selector_from_string($str){ |
| 710 | |
| 711 | // extract id and class using regex |
| 712 | preg_match('/id="([^"]*)"/', $str, $idMatch); |
| 713 | preg_match('/class="([^"]*)"/', $str, $classMatch); |
| 714 | |
| 715 | // construct jQuery selector |
| 716 | $selector = ''; |
| 717 | if(!empty($idMatch)){ |
| 718 | $selector .= '#' . $idMatch[1]; |
| 719 | } |
| 720 | if(!empty($classMatch)){ |
| 721 | $selector .= '.' . str_replace(' ', '.', $classMatch[1]); |
| 722 | } |
| 723 | |
| 724 | return $selector; |
| 725 | |
| 726 | } |
| 727 | |
| 728 | } |
| 729 | |
| 730 | acf_new_instance('acfe_module_form_front_render'); |
| 731 | |
| 732 | endif; |