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-action-term.php
1345 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')){ |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | if(!class_exists('acfe_module_form_action_term')): |
| 8 | |
| 9 | class acfe_module_form_action_term extends acfe_module_form_action{ |
| 10 | |
| 11 | /** |
| 12 | * initialize |
| 13 | */ |
| 14 | function initialize(){ |
| 15 | |
| 16 | $this->name = 'term'; |
| 17 | $this->title = __('Term action', 'acfe'); |
| 18 | $this->title_alt = __('Term', 'acfe'); |
| 19 | |
| 20 | $this->item = array( |
| 21 | 'action' => 'term', |
| 22 | 'type' => 'insert_term', // insert_term | update_term |
| 23 | 'name' => '', |
| 24 | 'save' => array( |
| 25 | 'target' => '', |
| 26 | 'name' => '', |
| 27 | 'slug' => '', |
| 28 | 'taxonomy' => '', |
| 29 | 'parent' => '', |
| 30 | 'description' => '', |
| 31 | 'acf_fields' => array(), |
| 32 | ), |
| 33 | 'load' => array( |
| 34 | 'source' => '', |
| 35 | 'name' => '', |
| 36 | 'slug' => '', |
| 37 | 'taxonomy' => '', |
| 38 | 'parent' => '', |
| 39 | 'description' => '', |
| 40 | 'acf_fields' => array(), |
| 41 | ), |
| 42 | ); |
| 43 | |
| 44 | $this->fields = array('name', 'slug', 'taxonomy', 'parent', 'description'); |
| 45 | |
| 46 | } |
| 47 | |
| 48 | |
| 49 | /** |
| 50 | * load_action |
| 51 | * |
| 52 | * acfe/form/load_term:9 |
| 53 | * |
| 54 | * @param $form |
| 55 | * @param $action |
| 56 | * |
| 57 | * @return array |
| 58 | */ |
| 59 | function load_action($form, $action){ |
| 60 | |
| 61 | // check source |
| 62 | if(!$action['load']['source']){ |
| 63 | return $form; |
| 64 | } |
| 65 | |
| 66 | // apply template tags |
| 67 | acfe_apply_tags($action['load']['source'], array('context' => 'load', 'format' => false)); |
| 68 | |
| 69 | // vars |
| 70 | $load = $action['load']; |
| 71 | $term_id = acf_extract_var($load, 'source'); |
| 72 | $acf_fields = acf_extract_var($load, 'acf_fields'); |
| 73 | $acf_fields = acfe_as_array($acf_fields); |
| 74 | $acf_fields_exclude = array(); |
| 75 | |
| 76 | // filters |
| 77 | $term_id = apply_filters("acfe/form/load_term_id", $term_id, $form, $action); |
| 78 | $term_id = apply_filters("acfe/form/load_term_id/form={$form['name']}", $term_id, $form, $action); |
| 79 | $term_id = apply_filters("acfe/form/load_term_id/action={$action['name']}", $term_id, $form, $action); |
| 80 | |
| 81 | // bail early if no source |
| 82 | if(!$term_id){ |
| 83 | return $form; |
| 84 | } |
| 85 | |
| 86 | // get source term |
| 87 | $term = get_term($term_id); |
| 88 | |
| 89 | // no term found |
| 90 | if(!$term || is_wp_error($term)){ |
| 91 | return $form; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * load term fields |
| 96 | * |
| 97 | * $load = array( |
| 98 | * name => 'field_655af3dd3bd56' |
| 99 | * slug => 'field_655af3dd3bd56' |
| 100 | * taxonomy => '' |
| 101 | * parent => '' |
| 102 | * description => '' |
| 103 | * ) |
| 104 | */ |
| 105 | foreach($load as $term_field => $field_key){ |
| 106 | |
| 107 | // check field is not hidden and has no value set in 'acfe/form/load_form' |
| 108 | if(acfe_get($form['map'], $field_key) !== false && !isset($form['map'][ $field_key ]['value'])){ |
| 109 | |
| 110 | // check key exists in WP_Term and is field key |
| 111 | if(in_array($term_field, $this->fields) && !empty($field_key) && is_string($field_key) && acf_is_field_key($field_key)){ |
| 112 | |
| 113 | // add field to excluded list |
| 114 | $acf_fields_exclude[] = $field_key; |
| 115 | |
| 116 | // assign term field as value |
| 117 | $form['map'][ $field_key ]['value'] = get_term_field($term_field, $term_id, '', 'raw'); |
| 118 | |
| 119 | } |
| 120 | |
| 121 | } |
| 122 | |
| 123 | } |
| 124 | |
| 125 | // load acf values |
| 126 | $form = $this->load_acf_values($form, "term_{$term_id}", $acf_fields, $acf_fields_exclude); |
| 127 | |
| 128 | // return |
| 129 | return $form; |
| 130 | |
| 131 | } |
| 132 | |
| 133 | |
| 134 | /** |
| 135 | * validate_action |
| 136 | * |
| 137 | * acfe/form/validate_term:9 |
| 138 | * |
| 139 | * @param $form |
| 140 | * @param $action |
| 141 | */ |
| 142 | function validate_action($form, $action){ |
| 143 | |
| 144 | // if(empty($action['save']['name'])){ |
| 145 | // acfe_add_validation_error('', __('Term name is empty', 'acfe')); |
| 146 | // } |
| 147 | // |
| 148 | // if(empty($action['save']['taxonomy'])){ |
| 149 | // acfe_add_validation_error('', __('Term taxonomy is empty', 'acfe')); |
| 150 | // } |
| 151 | |
| 152 | } |
| 153 | |
| 154 | |
| 155 | /** |
| 156 | * prepare_action |
| 157 | * |
| 158 | * acfe/form/prepare_term:9 |
| 159 | * |
| 160 | * @param $action |
| 161 | * @param $form |
| 162 | * |
| 163 | * @return array |
| 164 | */ |
| 165 | function prepare_action($action, $form){ |
| 166 | |
| 167 | return $action; |
| 168 | |
| 169 | } |
| 170 | |
| 171 | |
| 172 | /** |
| 173 | * make_action |
| 174 | * |
| 175 | * acfe/form/make_term:9 |
| 176 | * |
| 177 | * @param $form |
| 178 | * @param $action |
| 179 | */ |
| 180 | function make_action($form, $action){ |
| 181 | |
| 182 | // insert/update term |
| 183 | $process = $this->process($form, $action); |
| 184 | |
| 185 | // validate |
| 186 | if(!$process){ |
| 187 | return; |
| 188 | } |
| 189 | |
| 190 | // process vars |
| 191 | $term_id = $process['term_id']; |
| 192 | $args = $process['args']; |
| 193 | |
| 194 | // output |
| 195 | $this->generate_output($term_id, $args, $form, $action); |
| 196 | |
| 197 | // acf values |
| 198 | $this->save_acf_fields("term_{$term_id}", $action); |
| 199 | |
| 200 | // hooks |
| 201 | do_action("acfe/form/submit_term", $term_id, $args, $form, $action); |
| 202 | do_action("acfe/form/submit_term/form={$form['name']}", $term_id, $args, $form, $action); |
| 203 | do_action("acfe/form/submit_term/action={$action['name']}", $term_id, $args, $form, $action); |
| 204 | |
| 205 | } |
| 206 | |
| 207 | |
| 208 | /** |
| 209 | * setup_action |
| 210 | * |
| 211 | * @param $action |
| 212 | * @param $form |
| 213 | * |
| 214 | * @return array |
| 215 | */ |
| 216 | function setup_action($action, $form){ |
| 217 | |
| 218 | // check if post_parent has a field key or value |
| 219 | $has_term_parent = !acf_is_empty($action['save']['parent']); |
| 220 | |
| 221 | // tags context |
| 222 | $opt = array('context' => 'save'); |
| 223 | $opt_fmt = array('context' => 'save', 'format' => false); |
| 224 | |
| 225 | // apply tags |
| 226 | acfe_apply_tags($action['save']['target'], $opt_fmt); |
| 227 | acfe_apply_tags($action['save']['name'], $opt); |
| 228 | acfe_apply_tags($action['save']['slug'], $opt); |
| 229 | acfe_apply_tags($action['save']['taxonomy'], $opt_fmt); |
| 230 | acfe_apply_tags($action['save']['parent'], $opt_fmt); |
| 231 | acfe_apply_tags($action['save']['description'], $opt); |
| 232 | |
| 233 | // if post parent is supposed to have a value but is empty, set it to 0 |
| 234 | // parent was most likely removed from the field |
| 235 | if($has_term_parent && acf_is_empty($action['save']['parent'])){ |
| 236 | $action['save']['parent'] = 0; |
| 237 | } |
| 238 | |
| 239 | // return |
| 240 | return $action; |
| 241 | |
| 242 | } |
| 243 | |
| 244 | |
| 245 | /** |
| 246 | * process |
| 247 | * |
| 248 | * @param $form |
| 249 | * @param $action |
| 250 | * |
| 251 | * @return array|false |
| 252 | */ |
| 253 | function process($form, $action){ |
| 254 | |
| 255 | // apply tags |
| 256 | $action = $this->setup_action($action, $form); |
| 257 | |
| 258 | // vars |
| 259 | $save = $action['save']; |
| 260 | $term_id = (int) acf_extract_var($save, 'target'); |
| 261 | |
| 262 | // pre-insert term |
| 263 | if($action['type'] === 'insert_term'){ |
| 264 | |
| 265 | if(empty($action['save']['taxonomy'])){ |
| 266 | $action['save']['taxonomy'] = 'category'; |
| 267 | } |
| 268 | |
| 269 | // insert |
| 270 | $insert = wp_insert_term($save['name'], $save['taxonomy']); |
| 271 | |
| 272 | // invalid insert |
| 273 | if($insert && !is_wp_error($insert)){ |
| 274 | $term_id = $insert['term_id']; |
| 275 | } |
| 276 | |
| 277 | } |
| 278 | |
| 279 | // invalid target |
| 280 | if(!$term_id){ |
| 281 | return false; |
| 282 | } |
| 283 | |
| 284 | // generated id |
| 285 | acfe_add_context(array('context' => 'save', 'generated_id' => $term_id)); |
| 286 | |
| 287 | acfe_apply_tags($action['save']['name']); |
| 288 | acfe_apply_tags($action['save']['slug']); |
| 289 | |
| 290 | $save['name'] = $action['save']['name']; |
| 291 | $save['slug'] = $action['save']['slug']; |
| 292 | |
| 293 | acfe_delete_context('context', 'generated_id'); |
| 294 | |
| 295 | // get term |
| 296 | $term = get_term($term_id); |
| 297 | |
| 298 | // validate |
| 299 | if(!$term || is_wp_error($term)){ |
| 300 | return false; |
| 301 | } |
| 302 | |
| 303 | // default term arguments |
| 304 | $args = array( |
| 305 | 'ID' => $term_id, |
| 306 | 'taxonomy' => $term->taxonomy |
| 307 | ); |
| 308 | |
| 309 | // construct term arguments |
| 310 | foreach($save as $term_field => $value){ |
| 311 | |
| 312 | // name, slug, taxonomy, parent etc... |
| 313 | if(in_array($term_field, $this->fields) && !acf_is_empty($value)){ |
| 314 | $args[ $term_field ] = $value; |
| 315 | } |
| 316 | |
| 317 | } |
| 318 | |
| 319 | // filters |
| 320 | $args = apply_filters("acfe/form/submit_term_args", $args, $form, $action); |
| 321 | $args = apply_filters("acfe/form/submit_term_args/form={$form['name']}", $args, $form, $action); |
| 322 | $args = apply_filters("acfe/form/submit_term_args/action={$action['name']}", $args, $form, $action); |
| 323 | |
| 324 | // bail early |
| 325 | if($args === false){ |
| 326 | |
| 327 | // delete pre-insert term |
| 328 | if($action['type'] === 'insert_term'){ |
| 329 | wp_delete_term($term_id, $save['taxonomy']); |
| 330 | } |
| 331 | |
| 332 | return false; |
| 333 | |
| 334 | } |
| 335 | |
| 336 | // update term |
| 337 | $update = wp_update_term($args['ID'], $args['taxonomy'], $args); |
| 338 | |
| 339 | // bail early |
| 340 | if(!$update || is_wp_error($update)){ |
| 341 | return false; |
| 342 | } |
| 343 | |
| 344 | // return |
| 345 | return array( |
| 346 | 'term_id' => $update['term_id'], |
| 347 | 'args' => $args |
| 348 | ); |
| 349 | |
| 350 | } |
| 351 | |
| 352 | |
| 353 | /** |
| 354 | * generate_output |
| 355 | * |
| 356 | * @param $term_id |
| 357 | * @param $args |
| 358 | * @param $form |
| 359 | * @param $action |
| 360 | */ |
| 361 | function generate_output($term_id, $args, $form, $action){ |
| 362 | |
| 363 | // term array |
| 364 | $term = get_term($term_id, $args['taxonomy'], ARRAY_A); |
| 365 | $term['permalink'] = get_term_link($term_id, $args['taxonomy']); |
| 366 | $term['admin_url'] = admin_url("edit-tags.php?taxonomy={$args['taxonomy']}&tag_ID=1{$term_id}"); |
| 367 | |
| 368 | // filters |
| 369 | $term = apply_filters("acfe/form/submit_term_output", $term, $args, $form, $action); |
| 370 | $term = apply_filters("acfe/form/submit_term_output/form={$form['name']}", $term, $args, $form, $action); |
| 371 | $term = apply_filters("acfe/form/submit_term_output/action={$action['name']}", $term, $args, $form, $action); |
| 372 | |
| 373 | // action output |
| 374 | $this->set_action_output($term, $action); |
| 375 | |
| 376 | } |
| 377 | |
| 378 | |
| 379 | /** |
| 380 | * prepare_load_action |
| 381 | * |
| 382 | * acfe/module/prepare_load_action |
| 383 | * |
| 384 | * @param $action |
| 385 | * |
| 386 | * @return array |
| 387 | */ |
| 388 | function prepare_load_action($action){ |
| 389 | |
| 390 | // save loop |
| 391 | foreach(array_keys($action['save']) as $k){ |
| 392 | $action["save_{$k}"] = $action['save'][ $k ]; |
| 393 | } |
| 394 | |
| 395 | // groups |
| 396 | $keys = array( |
| 397 | 'save' => array( |
| 398 | 'target' => function($value){return !empty($value) && is_numeric($value);}, |
| 399 | 'description' => function($value){return acfe_is_html(nl2br($value));}, |
| 400 | 'parent' => function($value){return !empty($value) && is_numeric($value);}, |
| 401 | ), |
| 402 | 'load' => array( |
| 403 | 'source' => function($value){return !empty($value) && is_numeric($value);}, |
| 404 | ) |
| 405 | ); |
| 406 | |
| 407 | foreach($keys as $parent => $row){ |
| 408 | foreach($row as $key => $callback){ |
| 409 | |
| 410 | // save: target |
| 411 | $value = $action[ $parent ][ $key ]; |
| 412 | $action["{$parent}_{$key}_group"]["{$parent}_{$key}"] = $value; |
| 413 | $action["{$parent}_{$key}_group"]["{$parent}_{$key}_custom"] = ''; |
| 414 | |
| 415 | if(call_user_func_array($callback, array($value))){ |
| 416 | $action["{$parent}_{$key}_group"]["{$parent}_{$key}"] = 'custom'; |
| 417 | $action["{$parent}_{$key}_group"]["{$parent}_{$key}_custom"] = $value; |
| 418 | } |
| 419 | |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | // load loop |
| 424 | $load_active = false; |
| 425 | |
| 426 | foreach(array_keys($action['load']) as $k){ |
| 427 | |
| 428 | $action["load_{$k}"] = $action['load'][ $k ]; |
| 429 | |
| 430 | if(!empty($action['load'][ $k ])){ |
| 431 | $load_active = true; |
| 432 | } |
| 433 | |
| 434 | } |
| 435 | |
| 436 | $action['load_active'] = $load_active; |
| 437 | |
| 438 | // cleanup |
| 439 | unset($action['action']); |
| 440 | unset($action['save']); |
| 441 | unset($action['load']); |
| 442 | |
| 443 | return $action; |
| 444 | |
| 445 | } |
| 446 | |
| 447 | |
| 448 | /** |
| 449 | * prepare_save_action |
| 450 | * |
| 451 | * acfe/module/prepare_save_action |
| 452 | * |
| 453 | * @param $action |
| 454 | * @param $item |
| 455 | * |
| 456 | * @return mixed |
| 457 | */ |
| 458 | function prepare_save_action($action){ |
| 459 | |
| 460 | $save = $this->item; |
| 461 | |
| 462 | // general |
| 463 | $save['type'] = $action['type']; |
| 464 | $save['name'] = $action['name']; |
| 465 | |
| 466 | // save loop |
| 467 | foreach(array_keys($save['save']) as $k){ |
| 468 | |
| 469 | // taxonomy => save_taxonomy |
| 470 | if(acfe_get($action, "save_{$k}")){ |
| 471 | $save['save'][ $k ] = $action["save_{$k}"]; |
| 472 | } |
| 473 | |
| 474 | } |
| 475 | |
| 476 | // groups |
| 477 | $keys = array( |
| 478 | 'save' => array('target', 'description', 'parent'), |
| 479 | 'load' => array('source'), |
| 480 | ); |
| 481 | |
| 482 | foreach($keys as $parent => $row){ |
| 483 | foreach($row as $key){ |
| 484 | |
| 485 | $group = $action["{$parent}_{$key}_group"]; |
| 486 | $save[ $parent ][ $key ] = $group[ $key ]; |
| 487 | |
| 488 | if($group[ $key ] === 'custom'){ |
| 489 | $save[ $parent ][ $key ] = $group["{$key}_custom"]; |
| 490 | } |
| 491 | |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | // check load switch activated |
| 496 | if($action['load_active']){ |
| 497 | |
| 498 | // load loop |
| 499 | foreach(array_keys($save['load']) as $k){ |
| 500 | |
| 501 | // taxonomy => load_taxonomy |
| 502 | if(acfe_get($action, "load_{$k}")){ |
| 503 | |
| 504 | $value = $action["load_{$k}"]; |
| 505 | $save['load'][ $k ] = $value; |
| 506 | |
| 507 | // assign to save array when field_key |
| 508 | if(isset($save['save'][ $k ]) && !empty($value) && is_string($value) && acf_is_field_key($value)){ |
| 509 | $save['save'][ $k ] = "{field:$value}"; |
| 510 | } |
| 511 | |
| 512 | } |
| 513 | |
| 514 | } |
| 515 | |
| 516 | } |
| 517 | |
| 518 | // default save: target |
| 519 | if($action['type'] === 'update_term' && empty($save['save']['target'])){ |
| 520 | $save['save']['target'] = '{term}'; |
| 521 | } |
| 522 | |
| 523 | // default load: source |
| 524 | if($action['load_active'] && empty($save['load']['source'])){ |
| 525 | $save['load']['source'] = '{term}'; |
| 526 | } |
| 527 | |
| 528 | return $save; |
| 529 | |
| 530 | } |
| 531 | |
| 532 | |
| 533 | /** |
| 534 | * prepare_action_for_export |
| 535 | * |
| 536 | * @param $action |
| 537 | * |
| 538 | * @return mixed |
| 539 | */ |
| 540 | function prepare_action_for_export($action){ |
| 541 | |
| 542 | if($action['type'] === 'insert_term'){ |
| 543 | unset($action['save']['target']); |
| 544 | } |
| 545 | |
| 546 | if(empty($action['load']['source'])){ |
| 547 | unset($action['load']); |
| 548 | } |
| 549 | |
| 550 | return $action; |
| 551 | |
| 552 | } |
| 553 | |
| 554 | |
| 555 | /** |
| 556 | * register_layout |
| 557 | * |
| 558 | * @param $layout |
| 559 | * |
| 560 | * @return array |
| 561 | */ |
| 562 | function register_layout($layout){ |
| 563 | |
| 564 | return array( |
| 565 | |
| 566 | /** |
| 567 | * documentation |
| 568 | */ |
| 569 | array( |
| 570 | 'key' => 'field_doc', |
| 571 | 'label' => '', |
| 572 | 'name' => '', |
| 573 | 'type' => 'acfe_dynamic_render', |
| 574 | 'instructions' => '', |
| 575 | 'required' => 0, |
| 576 | 'conditional_logic' => 0, |
| 577 | 'wrapper' => array( |
| 578 | 'width' => '', |
| 579 | 'class' => '', |
| 580 | 'id' => '', |
| 581 | ), |
| 582 | 'render' => function(){ |
| 583 | echo '<a href="https://www.acf-extended.com/features/modules/dynamic-forms/term-action" target="_blank">' . __('Documentation', 'acfe') . '</a>'; |
| 584 | } |
| 585 | ), |
| 586 | |
| 587 | /** |
| 588 | * action |
| 589 | */ |
| 590 | array( |
| 591 | 'key' => 'field_tab_action', |
| 592 | 'label' => __('Action', 'acfe'), |
| 593 | 'name' => '', |
| 594 | 'type' => 'tab', |
| 595 | 'instructions' => '', |
| 596 | 'required' => 0, |
| 597 | 'conditional_logic' => 0, |
| 598 | 'wrapper' => array( |
| 599 | 'width' => '', |
| 600 | 'class' => '', |
| 601 | 'id' => '', |
| 602 | 'data-no-preference' => true, |
| 603 | ), |
| 604 | 'placement' => 'top', |
| 605 | 'endpoint' => 0, |
| 606 | ), |
| 607 | array( |
| 608 | 'key' => 'field_type', |
| 609 | 'label' => __('Action', 'acfe'), |
| 610 | 'name' => 'type', |
| 611 | 'type' => 'radio', |
| 612 | 'instructions' => '', |
| 613 | 'required' => 0, |
| 614 | 'conditional_logic' => 0, |
| 615 | 'wrapper' => array( |
| 616 | 'width' => '', |
| 617 | 'class' => '', |
| 618 | 'id' => '', |
| 619 | ), |
| 620 | 'choices' => array( |
| 621 | 'insert_term' => __('Create term', 'acfe'), |
| 622 | 'update_term' => __('Update term', 'acfe'), |
| 623 | ), |
| 624 | 'default_value' => 'insert_term', |
| 625 | ), |
| 626 | array( |
| 627 | 'key' => 'field_name', |
| 628 | 'label' => __('Action name', 'acfe'), |
| 629 | 'name' => 'name', |
| 630 | 'type' => 'acfe_slug', |
| 631 | 'instructions' => __('(Optional) Target this action using hooks.', 'acfe'), |
| 632 | 'required' => 0, |
| 633 | 'conditional_logic' => 0, |
| 634 | 'wrapper' => array( |
| 635 | 'width' => '', |
| 636 | 'class' => '', |
| 637 | 'id' => '', |
| 638 | 'data-instruction-placement' => 'field' |
| 639 | ), |
| 640 | 'acfe_permissions' => '', |
| 641 | 'default_value' => '', |
| 642 | 'placeholder' => __('Term', 'acfe'), |
| 643 | 'prepend' => '', |
| 644 | 'append' => '', |
| 645 | 'maxlength' => '', |
| 646 | ), |
| 647 | |
| 648 | /** |
| 649 | * save |
| 650 | */ |
| 651 | array( |
| 652 | 'key' => 'field_tab_save', |
| 653 | 'label' => __('Save', 'acfe'), |
| 654 | 'name' => '', |
| 655 | 'type' => 'tab', |
| 656 | 'instructions' => '', |
| 657 | 'required' => 0, |
| 658 | 'conditional_logic' => 0, |
| 659 | 'wrapper' => array( |
| 660 | 'width' => '', |
| 661 | 'class' => '', |
| 662 | 'id' => '', |
| 663 | ), |
| 664 | 'placement' => 'top', |
| 665 | 'endpoint' => 0, |
| 666 | ), |
| 667 | |
| 668 | |
| 669 | array( |
| 670 | 'key' => 'field_save_target_group', |
| 671 | 'label' => __('Target', 'acfe'), |
| 672 | 'name' => 'save_target_group', |
| 673 | 'type' => 'group', |
| 674 | 'instructions' => '', |
| 675 | 'required' => 0, |
| 676 | 'conditional_logic' => array( |
| 677 | array( |
| 678 | array( |
| 679 | 'field' => 'type', |
| 680 | 'operator' => '==', |
| 681 | 'value' => 'update_term', |
| 682 | ), |
| 683 | ), |
| 684 | ), |
| 685 | 'wrapper' => array( |
| 686 | 'width' => '', |
| 687 | 'class' => '', |
| 688 | 'id' => '', |
| 689 | ), |
| 690 | 'layout' => 'block', |
| 691 | 'acfe_seamless_style' => true, |
| 692 | 'acfe_group_modal' => 0, |
| 693 | 'sub_fields' => array( |
| 694 | array( |
| 695 | 'key' => 'field_save_target', |
| 696 | 'label' => '', |
| 697 | 'name' => 'target', |
| 698 | 'type' => 'select', |
| 699 | 'instructions' => '', |
| 700 | 'required' => 0, |
| 701 | 'conditional_logic' => 0, |
| 702 | 'wrapper' => array( |
| 703 | 'width' => '', |
| 704 | 'class' => '', |
| 705 | 'id' => '', |
| 706 | ), |
| 707 | 'choices' => array( |
| 708 | '{term}' => __('Current Term', 'acfe'), |
| 709 | '{term:parent}' => __('Current Term Parent', 'acfe'), |
| 710 | 'custom' => __('Term Selector', 'acfe'), |
| 711 | ), |
| 712 | 'default_value' => array(), |
| 713 | 'allow_null' => 1, |
| 714 | 'multiple' => 0, |
| 715 | 'ui' => 1, |
| 716 | 'return_format' => 'value', |
| 717 | 'placeholder' => __('Default', 'acfe'), |
| 718 | 'ajax' => 1, |
| 719 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 720 | 'allow_custom' => 1, |
| 721 | 'ajax_action' => 'acfe/form/map_field_ajax' |
| 722 | ), |
| 723 | array( |
| 724 | 'key' => 'field_save_target_custom', |
| 725 | 'label' => '', |
| 726 | 'name' => 'target_custom', |
| 727 | 'type' => 'acfe_taxonomy_terms', |
| 728 | 'instructions' => '', |
| 729 | 'required' => 0, |
| 730 | 'conditional_logic' => array( |
| 731 | array( |
| 732 | array( |
| 733 | 'field' => 'field_save_target', |
| 734 | 'operator' => '==', |
| 735 | 'value' => 'custom', |
| 736 | ), |
| 737 | ), |
| 738 | ), |
| 739 | 'wrapper' => array( |
| 740 | 'width' => '', |
| 741 | 'class' => '', |
| 742 | 'id' => '', |
| 743 | ), |
| 744 | 'field_type' => 'select', |
| 745 | 'return_format' => 'id', |
| 746 | 'ui' => true, |
| 747 | 'ajax' => true, |
| 748 | 'default_value' => '', |
| 749 | ), |
| 750 | ), |
| 751 | ), |
| 752 | |
| 753 | array( |
| 754 | 'key' => 'field_save_name', |
| 755 | 'label' => __('Name', 'acfe'), |
| 756 | 'name' => 'save_name', |
| 757 | 'type' => 'select', |
| 758 | 'instructions' => '', |
| 759 | 'required' => 0, |
| 760 | 'wrapper' => array( |
| 761 | 'width' => '', |
| 762 | 'class' => '', |
| 763 | 'id' => '', |
| 764 | ), |
| 765 | 'choices' => array( |
| 766 | '{generated_id}' => __('Generated ID', 'acfe'), |
| 767 | '#{generated_id}' => __('#Generated ID', 'acfe'), |
| 768 | ), |
| 769 | 'default_value' => array( |
| 770 | ), |
| 771 | 'allow_null' => 1, |
| 772 | 'multiple' => 0, |
| 773 | 'ui' => 1, |
| 774 | 'return_format' => 'value', |
| 775 | 'placeholder' => __('Default', 'acfe'), |
| 776 | 'ajax' => 1, |
| 777 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 778 | 'allow_custom' => 1, |
| 779 | 'conditional_logic' => array(), |
| 780 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 781 | ), |
| 782 | array( |
| 783 | 'key' => 'field_save_slug', |
| 784 | 'label' => __('Slug', 'acfe'), |
| 785 | 'name' => 'save_slug', |
| 786 | 'type' => 'select', |
| 787 | 'instructions' => '', |
| 788 | 'required' => 0, |
| 789 | 'wrapper' => array( |
| 790 | 'width' => '', |
| 791 | 'class' => '', |
| 792 | 'id' => '', |
| 793 | ), |
| 794 | 'choices' => array( |
| 795 | '{generated_id}' => __('Generated ID', 'acfe'), |
| 796 | ), |
| 797 | 'default_value' => array( |
| 798 | ), |
| 799 | 'allow_null' => 1, |
| 800 | 'multiple' => 0, |
| 801 | 'ui' => 1, |
| 802 | 'return_format' => 'value', |
| 803 | 'placeholder' => __('Default', 'acfe'), |
| 804 | 'ajax' => 1, |
| 805 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 806 | 'allow_custom' => 1, |
| 807 | 'conditional_logic' => array(), |
| 808 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 809 | ), |
| 810 | array( |
| 811 | 'key' => 'field_save_taxonomy', |
| 812 | 'label' => __('Taxonomy', 'acfe'), |
| 813 | 'name' => 'save_taxonomy', |
| 814 | 'type' => 'acfe_taxonomies', |
| 815 | 'instructions' => '', |
| 816 | 'required' => 0, |
| 817 | 'conditional_logic' => array(), |
| 818 | 'wrapper' => array( |
| 819 | 'width' => '', |
| 820 | 'class' => '', |
| 821 | 'id' => '', |
| 822 | ), |
| 823 | 'taxonomy' => '', |
| 824 | 'field_type' => 'select', |
| 825 | 'default_value' => '', |
| 826 | 'return_format' => 'name', |
| 827 | 'allow_null' => 1, |
| 828 | 'placeholder' => __('Default', 'acfe'), |
| 829 | 'multiple' => 0, |
| 830 | 'ui' => 1, |
| 831 | 'choices' => array(), |
| 832 | 'ajax' => 1, |
| 833 | 'layout' => '', |
| 834 | 'toggle' => 0, |
| 835 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 836 | 'allow_custom' => 1, |
| 837 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 838 | ), |
| 839 | |
| 840 | |
| 841 | array( |
| 842 | 'key' => 'field_save_parent_group', |
| 843 | 'label' => __('Parent', 'acfe'), |
| 844 | 'name' => 'save_parent_group', |
| 845 | 'type' => 'group', |
| 846 | 'instructions' => '', |
| 847 | 'required' => 0, |
| 848 | 'conditional_logic' => array(), |
| 849 | 'wrapper' => array( |
| 850 | 'width' => '', |
| 851 | 'class' => '', |
| 852 | 'id' => '', |
| 853 | ), |
| 854 | 'layout' => 'block', |
| 855 | 'acfe_seamless_style' => true, |
| 856 | 'acfe_group_modal' => 0, |
| 857 | 'sub_fields' => array( |
| 858 | array( |
| 859 | 'key' => 'field_save_parent', |
| 860 | 'label' => '', |
| 861 | 'name' => 'parent', |
| 862 | 'type' => 'select', |
| 863 | 'instructions' => '', |
| 864 | 'required' => 0, |
| 865 | 'conditional_logic' => 0, |
| 866 | 'wrapper' => array( |
| 867 | 'width' => '', |
| 868 | 'class' => '', |
| 869 | 'id' => '', |
| 870 | ), |
| 871 | 'choices' => array( |
| 872 | '{term}' => __('Current Term', 'acfe'), |
| 873 | '{term:parent}' => __('Current Term Parent', 'acfe'), |
| 874 | 'custom' => __('Term Selector', 'acfe'), |
| 875 | ), |
| 876 | 'default_value' => array(), |
| 877 | 'allow_null' => 1, |
| 878 | 'multiple' => 0, |
| 879 | 'ui' => 1, |
| 880 | 'return_format' => 'value', |
| 881 | 'placeholder' => __('Default', 'acfe'), |
| 882 | 'ajax' => 1, |
| 883 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 884 | 'allow_custom' => 1, |
| 885 | 'ajax_action' => 'acfe/form/map_field_ajax' |
| 886 | ), |
| 887 | array( |
| 888 | 'key' => 'field_save_parent_custom', |
| 889 | 'label' => '', |
| 890 | 'name' => 'parent_custom', |
| 891 | 'type' => 'acfe_taxonomy_terms', |
| 892 | 'instructions' => '', |
| 893 | 'required' => 0, |
| 894 | 'conditional_logic' => array( |
| 895 | array( |
| 896 | array( |
| 897 | 'field' => 'field_save_parent', |
| 898 | 'operator' => '==', |
| 899 | 'value' => 'custom', |
| 900 | ), |
| 901 | ), |
| 902 | ), |
| 903 | 'wrapper' => array( |
| 904 | 'width' => '', |
| 905 | 'class' => '', |
| 906 | 'id' => '', |
| 907 | ), |
| 908 | 'field_type' => 'select', |
| 909 | 'return_format' => 'id', |
| 910 | 'ui' => true, |
| 911 | 'ajax' => true, |
| 912 | 'default_value' => '', |
| 913 | ), |
| 914 | ), |
| 915 | ), |
| 916 | |
| 917 | array( |
| 918 | 'key' => 'field_save_description_group', |
| 919 | 'label' => __('Description', 'acfe'), |
| 920 | 'name' => 'save_description_group', |
| 921 | 'type' => 'group', |
| 922 | 'instructions' => '', |
| 923 | 'required' => 0, |
| 924 | 'conditional_logic' => array(), |
| 925 | 'wrapper' => array( |
| 926 | 'width' => '', |
| 927 | 'class' => '', |
| 928 | 'id' => '', |
| 929 | ), |
| 930 | 'layout' => 'block', |
| 931 | 'acfe_seamless_style' => true, |
| 932 | 'acfe_group_modal' => 0, |
| 933 | 'sub_fields' => array( |
| 934 | array( |
| 935 | 'key' => 'field_save_description', |
| 936 | 'label' => '', |
| 937 | 'name' => 'description', |
| 938 | 'type' => 'select', |
| 939 | 'instructions' => '', |
| 940 | 'required' => 0, |
| 941 | 'conditional_logic' => 0, |
| 942 | 'wrapper' => array( |
| 943 | 'width' => '', |
| 944 | 'class' => '', |
| 945 | 'id' => '', |
| 946 | ), |
| 947 | 'choices' => array( |
| 948 | 'custom' => __('Content Editor', 'acfe'), |
| 949 | ), |
| 950 | 'default_value' => array(), |
| 951 | 'allow_null' => 1, |
| 952 | 'multiple' => 0, |
| 953 | 'ui' => 1, |
| 954 | 'return_format' => 'value', |
| 955 | 'placeholder' => __('Default', 'acfe'), |
| 956 | 'ajax' => 1, |
| 957 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 958 | 'allow_custom' => 1, |
| 959 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 960 | ), |
| 961 | array( |
| 962 | 'key' => 'field_save_description_custom', |
| 963 | 'label' => '', |
| 964 | 'name' => 'description_custom', |
| 965 | 'type' => 'wysiwyg', |
| 966 | 'instructions' => '', |
| 967 | 'required' => 0, |
| 968 | 'conditional_logic' => array( |
| 969 | array( |
| 970 | array( |
| 971 | 'field' => 'field_save_description', |
| 972 | 'operator' => '==', |
| 973 | 'value' => 'custom', |
| 974 | ), |
| 975 | ), |
| 976 | ), |
| 977 | 'wrapper' => array( |
| 978 | 'width' => '', |
| 979 | 'class' => '', |
| 980 | 'id' => '', |
| 981 | ), |
| 982 | 'default_value' => '', |
| 983 | 'tabs' => 'all', |
| 984 | 'toolbar' => 'full', |
| 985 | 'media_upload' => 1, |
| 986 | 'delay' => 0, |
| 987 | ), |
| 988 | ), |
| 989 | ), |
| 990 | |
| 991 | array( |
| 992 | 'key' => 'field_save_acf_fields', |
| 993 | 'label' => __('Save ACF fields', 'acfe'), |
| 994 | 'name' => 'save_acf_fields', |
| 995 | 'type' => 'checkbox', |
| 996 | 'instructions' => __('Which ACF fields should be saved as metadata', 'acfe'), |
| 997 | 'required' => 0, |
| 998 | 'conditional_logic' => 0, |
| 999 | 'wrapper' => array( |
| 1000 | 'width' => '', |
| 1001 | 'class' => '', |
| 1002 | 'id' => '', |
| 1003 | ), |
| 1004 | 'choices' => array(), |
| 1005 | 'allow_custom' => 0, |
| 1006 | 'default_value' => array(), |
| 1007 | 'layout' => 'vertical', |
| 1008 | 'toggle' => 0, |
| 1009 | 'return_format' => 'value', |
| 1010 | 'save_custom' => 0, |
| 1011 | ), |
| 1012 | |
| 1013 | /** |
| 1014 | * load |
| 1015 | */ |
| 1016 | array( |
| 1017 | 'key' => 'field_tab_load', |
| 1018 | 'label' => __('Load', 'acfe'), |
| 1019 | 'name' => '', |
| 1020 | 'type' => 'tab', |
| 1021 | 'instructions' => '', |
| 1022 | 'required' => 0, |
| 1023 | 'conditional_logic' => 0, |
| 1024 | 'wrapper' => array( |
| 1025 | 'width' => '', |
| 1026 | 'class' => '', |
| 1027 | 'id' => '', |
| 1028 | ), |
| 1029 | 'placement' => 'top', |
| 1030 | 'endpoint' => 0, |
| 1031 | ), |
| 1032 | array( |
| 1033 | 'key' => 'field_load_active', |
| 1034 | 'label' => __('Load Values', 'acfe'), |
| 1035 | 'name' => 'load_active', |
| 1036 | 'type' => 'true_false', |
| 1037 | 'instructions' => __('Fill inputs with values', 'acfe'), |
| 1038 | 'required' => 0, |
| 1039 | 'conditional_logic' => 0, |
| 1040 | 'wrapper' => array( |
| 1041 | 'width' => '', |
| 1042 | 'class' => '', |
| 1043 | 'id' => '', |
| 1044 | ), |
| 1045 | 'message' => '', |
| 1046 | 'default_value' => 0, |
| 1047 | 'ui' => 1, |
| 1048 | 'ui_on_text' => '', |
| 1049 | 'ui_off_text' => '', |
| 1050 | ), |
| 1051 | |
| 1052 | |
| 1053 | array( |
| 1054 | 'key' => 'field_load_source_group', |
| 1055 | 'label' => __('Source', 'acfe'), |
| 1056 | 'name' => 'load_source_group', |
| 1057 | 'type' => 'group', |
| 1058 | 'instructions' => '', |
| 1059 | 'required' => 0, |
| 1060 | 'conditional_logic' => array( |
| 1061 | array( |
| 1062 | array( |
| 1063 | 'field' => 'field_load_active', |
| 1064 | 'operator' => '==', |
| 1065 | 'value' => '1', |
| 1066 | ), |
| 1067 | ), |
| 1068 | ), |
| 1069 | 'wrapper' => array( |
| 1070 | 'width' => '', |
| 1071 | 'class' => '', |
| 1072 | 'id' => '', |
| 1073 | ), |
| 1074 | 'layout' => 'block', |
| 1075 | 'acfe_seamless_style' => true, |
| 1076 | 'acfe_group_modal' => 0, |
| 1077 | 'sub_fields' => array( |
| 1078 | array( |
| 1079 | 'key' => 'field_load_source', |
| 1080 | 'label' => '', |
| 1081 | 'name' => 'source', |
| 1082 | 'type' => 'select', |
| 1083 | 'instructions' => '', |
| 1084 | 'required' => 0, |
| 1085 | 'conditional_logic' => 0, |
| 1086 | 'wrapper' => array( |
| 1087 | 'width' => '', |
| 1088 | 'class' => '', |
| 1089 | 'id' => '', |
| 1090 | ), |
| 1091 | 'choices' => array( |
| 1092 | '{term}' => __('Current Term', 'acfe'), |
| 1093 | '{term:parent}' => __('Current Term Parent', 'acfe'), |
| 1094 | 'custom' => __('Term Selector', 'acfe'), |
| 1095 | ), |
| 1096 | 'default_value' => array(), |
| 1097 | 'allow_null' => 1, |
| 1098 | 'multiple' => 0, |
| 1099 | 'ui' => 1, |
| 1100 | 'return_format' => 'value', |
| 1101 | 'placeholder' => __('Default', 'acfe'), |
| 1102 | 'ajax' => 1, |
| 1103 | 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'), |
| 1104 | 'allow_custom' => 1, |
| 1105 | 'ajax_action' => 'acfe/form/map_field_ajax' |
| 1106 | ), |
| 1107 | array( |
| 1108 | 'key' => 'field_load_source_custom', |
| 1109 | 'label' => '', |
| 1110 | 'name' => 'source_custom', |
| 1111 | 'type' => 'acfe_taxonomy_terms', |
| 1112 | 'instructions' => '', |
| 1113 | 'required' => 0, |
| 1114 | 'conditional_logic' => array( |
| 1115 | array( |
| 1116 | array( |
| 1117 | 'field' => 'field_load_source', |
| 1118 | 'operator' => '==', |
| 1119 | 'value' => 'custom', |
| 1120 | ), |
| 1121 | ), |
| 1122 | ), |
| 1123 | 'wrapper' => array( |
| 1124 | 'width' => '', |
| 1125 | 'class' => '', |
| 1126 | 'id' => '', |
| 1127 | ), |
| 1128 | 'field_type' => 'select', |
| 1129 | 'return_format' => 'id', |
| 1130 | 'ui' => true, |
| 1131 | 'ajax' => true, |
| 1132 | 'default_value' => '', |
| 1133 | ) |
| 1134 | ), |
| 1135 | ), |
| 1136 | |
| 1137 | array( |
| 1138 | 'key' => 'field_load_name', |
| 1139 | 'label' => __('Name', 'acfe'), |
| 1140 | 'name' => 'load_name', |
| 1141 | 'type' => 'select', |
| 1142 | 'instructions' => '', |
| 1143 | 'required' => 0, |
| 1144 | 'wrapper' => array( |
| 1145 | 'width' => '', |
| 1146 | 'class' => '', |
| 1147 | 'id' => '', |
| 1148 | 'data-related-field' => 'field_save_name' |
| 1149 | ), |
| 1150 | 'choices' => array(), |
| 1151 | 'default_value' => array(), |
| 1152 | 'allow_null' => 1, |
| 1153 | 'multiple' => 0, |
| 1154 | 'ui' => 1, |
| 1155 | 'return_format' => 'value', |
| 1156 | 'placeholder' => __('None', 'acfe'), |
| 1157 | 'ajax' => 1, |
| 1158 | 'search_placeholder' => __('Select a field or enter a field key', 'acfe'), |
| 1159 | 'allow_custom' => 1, |
| 1160 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 1161 | 'conditional_logic' => array( |
| 1162 | array( |
| 1163 | array( |
| 1164 | 'field' => 'field_load_active', |
| 1165 | 'operator' => '==', |
| 1166 | 'value' => '1', |
| 1167 | ), |
| 1168 | ), |
| 1169 | ), |
| 1170 | ), |
| 1171 | array( |
| 1172 | 'key' => 'field_load_slug', |
| 1173 | 'label' => __('Slug', 'acfe'), |
| 1174 | 'name' => 'load_slug', |
| 1175 | 'type' => 'select', |
| 1176 | 'instructions' => '', |
| 1177 | 'required' => 0, |
| 1178 | 'wrapper' => array( |
| 1179 | 'width' => '', |
| 1180 | 'class' => '', |
| 1181 | 'id' => '', |
| 1182 | 'data-related-field' => 'field_save_slug' |
| 1183 | ), |
| 1184 | 'choices' => array(), |
| 1185 | 'default_value' => array(), |
| 1186 | 'allow_null' => 1, |
| 1187 | 'multiple' => 0, |
| 1188 | 'ui' => 1, |
| 1189 | 'return_format' => 'value', |
| 1190 | 'placeholder' => __('None', 'acfe'), |
| 1191 | 'ajax' => 1, |
| 1192 | 'search_placeholder' => __('Select a field or enter a field key', 'acfe'), |
| 1193 | 'allow_custom' => 1, |
| 1194 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 1195 | 'conditional_logic' => array( |
| 1196 | array( |
| 1197 | array( |
| 1198 | 'field' => 'field_load_active', |
| 1199 | 'operator' => '==', |
| 1200 | 'value' => '1', |
| 1201 | ), |
| 1202 | ), |
| 1203 | ), |
| 1204 | ), |
| 1205 | array( |
| 1206 | 'key' => 'field_load_taxonomy', |
| 1207 | 'label' => __('Taxonomy', 'acfe'), |
| 1208 | 'name' => 'load_taxonomy', |
| 1209 | 'type' => 'select', |
| 1210 | 'instructions' => '', |
| 1211 | 'required' => 0, |
| 1212 | 'wrapper' => array( |
| 1213 | 'width' => '', |
| 1214 | 'class' => '', |
| 1215 | 'id' => '', |
| 1216 | 'data-related-field' => 'field_save_taxonomy' |
| 1217 | ), |
| 1218 | 'choices' => array(), |
| 1219 | 'default_value' => array(), |
| 1220 | 'allow_null' => 1, |
| 1221 | 'multiple' => 0, |
| 1222 | 'ui' => 1, |
| 1223 | 'return_format' => 'value', |
| 1224 | 'placeholder' => __('None', 'acfe'), |
| 1225 | 'ajax' => 1, |
| 1226 | 'search_placeholder' => __('Select a field or enter a field key', 'acfe'), |
| 1227 | 'allow_custom' => 1, |
| 1228 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 1229 | 'conditional_logic' => array( |
| 1230 | array( |
| 1231 | array( |
| 1232 | 'field' => 'field_load_active', |
| 1233 | 'operator' => '==', |
| 1234 | 'value' => '1', |
| 1235 | ), |
| 1236 | ), |
| 1237 | ), |
| 1238 | ), |
| 1239 | array( |
| 1240 | 'key' => 'field_load_parent', |
| 1241 | 'label' => __('Parent', 'acfe'), |
| 1242 | 'name' => 'load_parent', |
| 1243 | 'type' => 'select', |
| 1244 | 'instructions' => '', |
| 1245 | 'required' => 0, |
| 1246 | 'wrapper' => array( |
| 1247 | 'width' => '', |
| 1248 | 'class' => '', |
| 1249 | 'id' => '', |
| 1250 | 'data-related-field' => 'field_save_parent' |
| 1251 | ), |
| 1252 | 'choices' => array(), |
| 1253 | 'default_value' => array(), |
| 1254 | 'allow_null' => 1, |
| 1255 | 'multiple' => 0, |
| 1256 | 'ui' => 1, |
| 1257 | 'return_format' => 'value', |
| 1258 | 'placeholder' => __('None', 'acfe'), |
| 1259 | 'ajax' => 1, |
| 1260 | 'search_placeholder' => __('Select a field or enter a field key', 'acfe'), |
| 1261 | 'allow_custom' => 1, |
| 1262 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 1263 | 'conditional_logic' => array( |
| 1264 | array( |
| 1265 | array( |
| 1266 | 'field' => 'field_load_active', |
| 1267 | 'operator' => '==', |
| 1268 | 'value' => '1', |
| 1269 | ), |
| 1270 | ), |
| 1271 | ), |
| 1272 | ), |
| 1273 | array( |
| 1274 | 'key' => 'field_load_description', |
| 1275 | 'label' => __('Description', 'acfe'), |
| 1276 | 'name' => 'load_description', |
| 1277 | 'type' => 'select', |
| 1278 | 'instructions' => '', |
| 1279 | 'required' => 0, |
| 1280 | 'wrapper' => array( |
| 1281 | 'width' => '', |
| 1282 | 'class' => '', |
| 1283 | 'id' => '', |
| 1284 | 'data-related-field' => 'field_save_description' |
| 1285 | ), |
| 1286 | 'choices' => array(), |
| 1287 | 'default_value' => array(), |
| 1288 | 'allow_null' => 1, |
| 1289 | 'multiple' => 0, |
| 1290 | 'ui' => 1, |
| 1291 | 'return_format' => 'value', |
| 1292 | 'placeholder' => __('None', 'acfe'), |
| 1293 | 'ajax' => 1, |
| 1294 | 'search_placeholder' => __('Select a field or enter a field key', 'acfe'), |
| 1295 | 'allow_custom' => 1, |
| 1296 | 'ajax_action' => 'acfe/form/map_field_ajax', |
| 1297 | 'conditional_logic' => array( |
| 1298 | array( |
| 1299 | array( |
| 1300 | 'field' => 'field_load_active', |
| 1301 | 'operator' => '==', |
| 1302 | 'value' => '1', |
| 1303 | ), |
| 1304 | ), |
| 1305 | ), |
| 1306 | ), |
| 1307 | array( |
| 1308 | 'key' => 'field_load_acf_fields', |
| 1309 | 'label' => __('Load ACF fields', 'acfe'), |
| 1310 | 'name' => 'load_acf_fields', |
| 1311 | 'type' => 'checkbox', |
| 1312 | 'instructions' => __('Select which ACF fields should have their values loaded', 'acfe'), |
| 1313 | 'required' => 0, |
| 1314 | 'conditional_logic' => array( |
| 1315 | array( |
| 1316 | array( |
| 1317 | 'field' => 'field_load_active', |
| 1318 | 'operator' => '==', |
| 1319 | 'value' => '1', |
| 1320 | ), |
| 1321 | ), |
| 1322 | ), |
| 1323 | 'wrapper' => array( |
| 1324 | 'width' => '', |
| 1325 | 'class' => '', |
| 1326 | 'id' => '', |
| 1327 | ), |
| 1328 | 'choices' => array(), |
| 1329 | 'allow_custom' => 0, |
| 1330 | 'default_value' => array(), |
| 1331 | 'layout' => 'vertical', |
| 1332 | 'toggle' => 0, |
| 1333 | 'return_format' => 'value', |
| 1334 | 'save_custom' => 0, |
| 1335 | ), |
| 1336 | |
| 1337 | ); |
| 1338 | |
| 1339 | } |
| 1340 | |
| 1341 | } |
| 1342 | |
| 1343 | acfe_register_form_action_type('acfe_module_form_action_term'); |
| 1344 | |
| 1345 | endif; |