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