html-location-rule.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. // vars
  3. $prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . ']';
  4. ?>
  5. <tr data-id="<?php echo $rule['id']; ?>">
  6. <td class="param">
  7. <?php
  8. // vars
  9. $choices = acf_get_location_rule_types();
  10. // array
  11. if ( is_array( $choices ) ) {
  12. acf_render_field(
  13. array(
  14. 'type' => 'select',
  15. 'name' => 'param',
  16. 'prefix' => $prefix,
  17. 'value' => $rule['param'],
  18. 'choices' => $choices,
  19. 'class' => 'refresh-location-rule',
  20. )
  21. );
  22. }
  23. ?>
  24. </td>
  25. <td class="operator">
  26. <?php
  27. // vars
  28. $choices = acf_get_location_rule_operators( $rule );
  29. // array
  30. if ( is_array( $choices ) ) {
  31. acf_render_field(
  32. array(
  33. 'type' => 'select',
  34. 'name' => 'operator',
  35. 'prefix' => $prefix,
  36. 'value' => $rule['operator'],
  37. 'choices' => $choices,
  38. )
  39. );
  40. // custom
  41. } else {
  42. echo $choices;
  43. }
  44. ?>
  45. </td>
  46. <td class="value">
  47. <?php
  48. // vars
  49. $choices = acf_get_location_rule_values( $rule );
  50. // array
  51. if ( is_array( $choices ) ) {
  52. acf_render_field(
  53. array(
  54. 'type' => 'select',
  55. 'name' => 'value',
  56. 'prefix' => $prefix,
  57. 'value' => $rule['value'],
  58. 'choices' => $choices,
  59. )
  60. );
  61. // custom
  62. } else {
  63. echo $choices;
  64. }
  65. ?>
  66. </td>
  67. <td class="add">
  68. <a href="#" class="button add-location-rule"><?php _e( 'and', 'acf' ); ?></a>
  69. </td>
  70. <td class="remove">
  71. <a href="#" class="acf-icon -minus remove-location-rule"></a>
  72. </td>
  73. </tr>