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
fields.php
140 lines
| 1 | <?php |
| 2 | //phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template include file |
| 3 | $field_groups = acf_get_field_groups(); |
| 4 | $num_field_groups = 0; |
| 5 | if ( is_array( $field_groups ) ) { |
| 6 | $num_field_groups = count( $field_groups ); |
| 7 | } |
| 8 | $is_subfield = ! empty( $is_subfield ); |
| 9 | $wrapper_class = ''; |
| 10 | if ( $is_subfield ) { |
| 11 | $wrapper_class = ' acf-is-subfields'; |
| 12 | if ( ! $fields ) { |
| 13 | $wrapper_class .= ' -empty'; |
| 14 | } |
| 15 | } elseif ( ! $fields && ! $parent ) { |
| 16 | /** |
| 17 | * Filter for determining if a new field group should render with a text field automatically |
| 18 | * |
| 19 | * @since ACF 6.2 |
| 20 | * |
| 21 | * @param bool $bool If an empty field group should render with a new field auto appended. |
| 22 | */ |
| 23 | if ( apply_filters( 'acf/field_group/auto_add_first_field', true ) ) { |
| 24 | $wrapper_class = ' acf-auto-add-field'; |
| 25 | } else { |
| 26 | $wrapper_class = ' -empty'; |
| 27 | } |
| 28 | } |
| 29 | ?> |
| 30 | <?php if ( $parent || $is_subfield ) { ?> |
| 31 | <div class="acf-sub-field-list-header"> |
| 32 | <h3 class="acf-sub-field-list-title"><?php esc_html_e( 'Fields', 'secure-custom-fields' ); ?></h3> |
| 33 | <a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php esc_html_e( 'Add Field', 'secure-custom-fields' ); ?></a> |
| 34 | </div> |
| 35 | <?php } ?> |
| 36 | <?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?> |
| 37 | <div class="acf-field-list-wrap<?php echo $wrapper_class; ?>"> |
| 38 | |
| 39 | <ul class="acf-hl acf-thead"> |
| 40 | <li class="li-field-order"> |
| 41 | <?php |
| 42 | /* translators: A symbol (or text, if not available in your locale) meaning "Order Number", in terms of positional placement. */ |
| 43 | esc_html_e( '#', 'secure-custom-fields' ); |
| 44 | ?> |
| 45 | <span class="acf-hidden"> |
| 46 | <?php |
| 47 | /* translators: Hidden accessibility text for the positional order number of the field. */ |
| 48 | esc_html_e( 'Order', 'secure-custom-fields' ); |
| 49 | ?> |
| 50 | </span> |
| 51 | </li> |
| 52 | <li class="li-field-label"><?php esc_html_e( 'Label', 'secure-custom-fields' ); ?></li> |
| 53 | <li class="li-field-name"><?php esc_html_e( 'Name', 'secure-custom-fields' ); ?></li> |
| 54 | <li class="li-field-key"><?php esc_html_e( 'Key', 'secure-custom-fields' ); ?></li> |
| 55 | <li class="li-field-type"><?php esc_html_e( 'Type', 'secure-custom-fields' ); ?></li> |
| 56 | </ul> |
| 57 | |
| 58 | <?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?> |
| 59 | <div class="acf-field-list<?php echo $wrapper_class; ?>"> |
| 60 | |
| 61 | <div class="no-fields-message"> |
| 62 | <div class="no-fields-message-inner"> |
| 63 | <img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-group.svg' ) ); ?>" /> |
| 64 | <h2><?php esc_html_e( 'Add Your First Field', 'secure-custom-fields' ); ?></h2> |
| 65 | <p><?php esc_html_e( 'Get started creating new custom fields for your posts, pages, custom post types and other WordPress content.', 'secure-custom-fields' ); ?></p> |
| 66 | <a href="#" class="acf-btn acf-btn-primary add-field add-first-field |
| 67 | "><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Field', 'secure-custom-fields' ); ?></a> |
| 68 | <p class="acf-small"> |
| 69 | <?php |
| 70 | echo acf_esc_html( |
| 71 | sprintf( |
| 72 | /* translators: %s url to field types list */ |
| 73 | __( 'Choose from over 30 field types. <a href="%s" target="_blank">Learn more</a>.', 'secure-custom-fields' ), |
| 74 | 'https://developer.wordpress.org/secure-custom-fields/features/fields/' |
| 75 | ) |
| 76 | ); |
| 77 | ?> |
| 78 | </p> |
| 79 | </div> |
| 80 | </div> |
| 81 | |
| 82 | <?php |
| 83 | if ( $fields ) : |
| 84 | foreach ( $fields as $i => $field ) : |
| 85 | acf_get_view( |
| 86 | 'acf-field-group/field', |
| 87 | array( |
| 88 | 'field' => $field, |
| 89 | 'i' => $i, |
| 90 | 'num_field_groups' => $num_field_groups, |
| 91 | ) |
| 92 | ); |
| 93 | endforeach; |
| 94 | endif; |
| 95 | ?> |
| 96 | |
| 97 | </div> |
| 98 | |
| 99 | <ul class="acf-hl acf-tfoot"> |
| 100 | <li class="acf-fr"> |
| 101 | <a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php esc_html_e( 'Add Field', 'secure-custom-fields' ); ?></a> |
| 102 | </li> |
| 103 | </ul> |
| 104 | |
| 105 | <?php |
| 106 | if ( ! $parent ) : |
| 107 | |
| 108 | // get clone |
| 109 | global $field_group; |
| 110 | $clone = acf_get_valid_field( |
| 111 | array( |
| 112 | 'ID' => 'acfcloneindex', |
| 113 | 'key' => 'acfcloneindex', |
| 114 | 'label' => __( 'New Field', 'secure-custom-fields' ), |
| 115 | 'name' => 'new_field', |
| 116 | 'type' => 'text', |
| 117 | 'parent' => isset( $field_group['ID'] ) ? $field_group['ID'] : 0, |
| 118 | ) |
| 119 | ); |
| 120 | |
| 121 | ?> |
| 122 | <script type="text/html" id="tmpl-acf-field"> |
| 123 | <?php |
| 124 | acf_get_view( |
| 125 | 'acf-field-group/field', |
| 126 | array( |
| 127 | 'field' => $clone, |
| 128 | 'i' => 0, |
| 129 | 'num_field_groups' => $num_field_groups, |
| 130 | ) |
| 131 | ); |
| 132 | ?> |
| 133 | </script> |
| 134 | <script type="text/html" id="tmpl-acf-browse-fields-modal"> |
| 135 | <?php acf_get_view( 'browse-fields-modal' ); ?> |
| 136 | </script> |
| 137 | <?php endif; ?> |
| 138 | |
| 139 | </div> |
| 140 |