PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / trunk
Secure Custom Fields vtrunk
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / admin / views / acf-field-group / field.php
secure-custom-fields / includes / admin / views / acf-field-group Last commit date
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
field.php
320 lines
1 <?php
2 //phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included template file.
3
4 // Define input name prefix using unique identifier.
5 $input_prefix = 'acf_fields[' . $field['ID'] . ']';
6 $input_id = acf_idify( $input_prefix );
7
8 // Update field props.
9 $field['prefix'] = $input_prefix;
10
11 // Elements.
12 $div_attrs = array(
13 'class' => 'acf-field-object acf-field-object-' . acf_slugify( $field['type'] ),
14 'data-id' => $field['ID'],
15 'data-key' => $field['key'],
16 'data-type' => $field['type'],
17 );
18
19 // Add additional class if the field is an endpoint.
20 if ( isset( $field['endpoint'] ) && $field['endpoint'] ) {
21 $div_attrs['class'] .= ' acf-field-is-endpoint';
22 }
23
24
25 // Misc template vars.
26 $field_label = acf_get_field_label( $field, 'admin' );
27 $field_type_label = acf_get_field_type_label( $field['type'] );
28 $field_type_supports = acf_get_field_type_prop( $field['type'], 'supports' );
29 $inactive_field_class = '';
30 $inactive_field_title = '';
31
32 if ( ! isset( $num_field_groups ) ) {
33 $num_field_groups = 0;
34 }
35
36 $conditional_logic_class = $conditional_logic_text = '';
37 if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic'] ) && count( $field['conditional_logic'] ) > 0 ) {
38 $conditional_logic_class = ' is-enabled';
39 $conditional_logic_text = __( 'Active', 'secure-custom-fields' );
40 }
41
42 ?>
43 <div <?php echo acf_esc_attrs( $div_attrs ); ?>>
44
45 <div class="meta">
46 <?php
47 $meta_inputs = array(
48 'ID' => $field['ID'],
49 'key' => $field['key'],
50 'parent' => $field['parent'],
51 'menu_order' => $i,
52 'save' => '',
53 );
54 foreach ( $meta_inputs as $k => $v ) :
55 acf_hidden_input(
56 array(
57 'name' => $input_prefix . '[' . $k . ']',
58 'value' => $v,
59 'id' => $input_id . '-' . $k,
60 )
61 );
62 endforeach;
63 ?>
64 </div>
65
66 <div class="handle">
67 <ul class="acf-hl acf-tbody">
68 <li class="li-field-order">
69 <span class="acf-icon acf-sortable-handle" title="<?php esc_attr_e( 'Drag to reorder', 'secure-custom-fields' ); ?>"><?php echo intval( $i + 1 ); ?></span>
70 </li>
71 <li class="li-field-label">
72 <strong class="<?php echo esc_attr( $inactive_field_class ); ?>" title="<?php echo esc_attr( $inactive_field_title ); ?>">
73 <a class="edit-field" title="<?php esc_attr_e( 'Edit field', 'secure-custom-fields' ); ?>" href="#"><?php echo acf_esc_html( $field_label ); ?></a>
74 </strong>
75 <div class="row-options">
76 <a class="edit-field" title="<?php esc_attr_e( 'Edit field', 'secure-custom-fields' ); ?>" href="#"><?php esc_html_e( 'Edit', 'secure-custom-fields' ); ?></a>
77 <a class="duplicate-field" title="<?php esc_attr_e( 'Duplicate field', 'secure-custom-fields' ); ?>" href="#"><?php esc_html_e( 'Duplicate', 'secure-custom-fields' ); ?></a>
78 <?php if ( $num_field_groups > 1 ) : ?>
79 <a class="move-field" title="<?php esc_attr_e( 'Move field to another group', 'secure-custom-fields' ); ?>" href="#"><?php esc_html_e( 'Move', 'secure-custom-fields' ); ?></a>
80 <?php endif; ?>
81 <a class="delete-field" title="<?php esc_attr_e( 'Delete field', 'secure-custom-fields' ); ?>" href="#"><?php esc_html_e( 'Delete', 'secure-custom-fields' ); ?></a>
82 </div>
83 </li>
84 <li class="li-field-name"><span class="copyable"><?php echo esc_html( $field['name'] ); ?></span></li>
85 <li class="li-field-key"><span class="copyable"><?php echo esc_html( $field['key'] ); ?></span></li>
86 <li class="li-field-type">
87 <i class="field-type-icon field-type-icon-<?php echo esc_attr( acf_slugify( $field['type'] ) ); ?>"></i>
88 <span class="field-type-label">
89 <?php echo acf_esc_html( $field_type_label ); ?>
90 </span>
91 </li>
92 </ul>
93 </div>
94
95 <div class="settings">
96 <div class="acf-field-editor">
97 <div class="acf-field-settings acf-fields">
98
99 <?php
100 foreach ( acf_get_combined_field_type_settings_tabs() as $tab_key => $tab_label ) {
101 $field_to_render = array(
102 'type' => 'tab',
103 'label' => $tab_label,
104 'key' => 'acf_field_settings_tabs',
105 'settings-type' => $tab_key,
106 );
107
108 if ( $tab_key === 'conditional_logic' ) {
109 $field_to_render['label'] = __( 'Conditional Logic', 'secure-custom-fields' ) . '<i class="conditional-logic-badge' . $conditional_logic_class . '">' . $conditional_logic_text . '</i>';
110 }
111
112 acf_render_field_wrap( $field_to_render );
113 ?>
114 <?php
115 $wrapper_class = str_replace( '_', '-', $tab_key );
116 ?>
117 <div class="acf-field-settings-main acf-field-settings-main-<?php echo esc_attr( $wrapper_class ); ?>">
118 <?php
119 switch ( $tab_key ) {
120 case 'general':
121 $field_type_select_class = 'field-type';
122 if ( ! apply_filters( 'acf/field_group/enable_field_type_select2', true ) ) {
123 $field_type_select_class .= ' disable-select2';
124 }
125 // type
126 acf_render_field_setting(
127 $field,
128 array(
129 'label' => __( 'Field Type', 'secure-custom-fields' ),
130 'instructions' => '',
131 'type' => 'select',
132 'name' => 'type',
133 'choices' => acf_get_grouped_field_types(),
134 'class' => $field_type_select_class,
135 ),
136 true
137 );
138
139 if ( apply_filters( 'acf/field_group/enable_field_browser', true ) ) {
140 ?>
141 <div class="acf-field acf-field-setting-browse-fields" data-append="type">
142 <div class="acf-input">
143 <button class="acf-btn browse-fields">
144 <i class="acf-icon acf-icon-dots-grid"></i>
145 <?php esc_html_e( 'Browse Fields', 'secure-custom-fields' ); ?>
146 </button>
147 </div>
148 </div>
149 <?php
150 }
151
152 // label
153 acf_render_field_setting(
154 $field,
155 array(
156 'label' => __( 'Field Label', 'secure-custom-fields' ),
157 'instructions' => __( 'This is the name which will appear on the EDIT page', 'secure-custom-fields' ),
158 'name' => 'label',
159 'type' => 'text',
160 'class' => 'field-label',
161 ),
162 true
163 );
164
165 // name
166 acf_render_field_setting(
167 $field,
168 array(
169 'label' => __( 'Field Name', 'secure-custom-fields' ),
170 'instructions' => __( 'Single word, no spaces. Underscores and dashes allowed', 'secure-custom-fields' ),
171 'name' => 'name',
172 'type' => 'text',
173 'class' => 'field-name',
174 ),
175 true
176 );
177
178 // 3rd party settings
179 do_action( 'acf/render_field_settings', $field );
180 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
181 ?>
182 <div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
183 <?php
184 do_action( "acf/render_field_settings/type={$field['type']}", $field );
185 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
186 do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
187 do_action( "acf/render_field_{$tab_key}_settings", $field );
188 ?>
189 </div>
190 <?php
191 break;
192 case 'validation':
193 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
194 ?>
195 <div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
196 <?php
197 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
198 do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
199 do_action( "acf/render_field_{$tab_key}_settings", $field );
200 ?>
201 </div>
202 <?php
203 break;
204 case 'presentation':
205 acf_render_field_setting(
206 $field,
207 array(
208 'label' => __( 'Instructions', 'secure-custom-fields' ),
209 'instructions' => __( 'Instructions for content editors. Shown when submitting data.', 'secure-custom-fields' ),
210 'type' => 'textarea',
211 'name' => 'instructions',
212 'rows' => 5,
213 ),
214 true
215 );
216
217 acf_render_field_wrap(
218 array(
219 'label' => '',
220 'instructions' => '',
221 'type' => 'text',
222 'name' => 'class',
223 'prefix' => $field['prefix'] . '[wrapper]',
224 'value' => $field['wrapper']['class'],
225 'prepend' => __( 'class', 'secure-custom-fields' ),
226 'wrapper' => array(
227 'data-append' => 'wrapper',
228 ),
229 ),
230 'div'
231 );
232
233 acf_render_field_wrap(
234 array(
235 'label' => '',
236 'instructions' => '',
237 'type' => 'text',
238 'name' => 'id',
239 'prefix' => $field['prefix'] . '[wrapper]',
240 'value' => $field['wrapper']['id'],
241 'prepend' => __( 'id', 'secure-custom-fields' ),
242 'wrapper' => array(
243 'data-append' => 'wrapper',
244 ),
245 ),
246 'div'
247 );
248
249 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
250 ?>
251 <div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
252 <?php
253 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
254 do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
255 do_action( "acf/render_field_{$tab_key}_settings", $field );
256 ?>
257 </div>
258 <?php
259
260 acf_render_field_wrap(
261 array(
262 'label' => __( 'Wrapper Attributes', 'secure-custom-fields' ),
263 'instructions' => '',
264 'type' => 'number',
265 'name' => 'width',
266 'prefix' => $field['prefix'] . '[wrapper]',
267 'value' => $field['wrapper']['width'],
268 'prepend' => __( 'width', 'secure-custom-fields' ),
269 'append' => '%',
270 'wrapper' => array(
271 'data-name' => 'wrapper',
272 'class' => 'acf-field-setting-wrapper',
273 ),
274 ),
275 'div'
276 );
277 break;
278 case 'conditional_logic':
279 acf_get_view( 'acf-field-group/conditional-logic', array( 'field' => $field ) );
280
281 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
282 ?>
283 <div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
284 <?php
285 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
286 do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
287 do_action( "acf/render_field_{$tab_key}_settings", $field );
288 ?>
289 </div>
290 <?php
291 break;
292 default:
293 // Global action hook for custom tabs.
294 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
295 ?>
296 <div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
297 <?php
298 // Type-specific action hook for custom tabs.
299 do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
300 do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
301 do_action( "acf/render_field_{$tab_key}_settings", $field );
302 ?>
303 </div>
304 <?php
305 }
306 ?>
307 </div>
308 <?php
309 }
310
311 ?>
312 <div class="acf-field-settings-footer">
313 <a class="button close-field edit-field" title="<?php esc_attr_e( 'Close Field', 'secure-custom-fields' ); ?>" href="#"><?php esc_html_e( 'Close Field', 'secure-custom-fields' ); ?></a>
314 </div>
315 </div>
316 </div>
317 </div>
318
319 </div>
320