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