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