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 / assets / src / js / _field-group-compatibility.js
secure-custom-fields / assets / src / js Last commit date
bindings 6 months ago commands 2 weeks ago pro 2 weeks ago _acf-compatibility.js 1 year ago _acf-condition-types.js 8 months ago _acf-condition.js 1 year ago _acf-conditions.js 1 year ago _acf-field-accordion.js 6 months ago _acf-field-button-group.js 8 months ago _acf-field-checkbox.js 1 month ago _acf-field-color-picker.js 8 months ago _acf-field-date-picker.js 1 month ago _acf-field-date-time-picker.js 1 month ago _acf-field-file.js 1 month ago _acf-field-google-map.js 6 months ago _acf-field-icon-picker.js 1 month ago _acf-field-image.js 1 month ago _acf-field-link.js 1 year ago _acf-field-oembed.js 1 month ago _acf-field-page-link.js 1 year ago _acf-field-post-object.js 1 year ago _acf-field-radio.js 1 month ago _acf-field-range.js 1 year ago _acf-field-relationship.js 1 month ago _acf-field-select.js 1 month ago _acf-field-tab.js 1 month ago _acf-field-taxonomy.js 8 months ago _acf-field-time-picker.js 1 month ago _acf-field-true-false.js 1 month ago _acf-field-url.js 1 year ago _acf-field-user.js 1 year ago _acf-field-wysiwyg.js 1 month ago _acf-field.js 1 year ago _acf-fields.js 1 year ago _acf-helpers.js 1 year ago _acf-hooks.js 1 year ago _acf-internal-post-type.js 8 months ago _acf-media.js 2 weeks ago _acf-modal.js 1 year ago _acf-model.js 1 year ago _acf-notice.js 8 months ago _acf-panel.js 1 year ago _acf-popup.js 8 months ago _acf-postbox.js 1 year ago _acf-screen.js 10 months ago _acf-select2.js 1 year ago _acf-tinymce.js 6 months ago _acf-tooltip.js 10 months ago _acf-unload.js 1 year ago _acf-validation.js 1 month ago _acf.js 7 months ago _browse-fields-modal.js 8 months ago _field-group-compatibility.js 1 year ago _field-group-conditions.js 1 year ago _field-group-field.js 4 months ago _field-group-fields.js 10 months ago _field-group-locations.js 1 year ago _field-group-settings.js 1 year ago _field-group.js 10 months ago acf-escaped-html-notice.js 1 year ago acf-field-group.js 1 year ago acf-input.js 1 year ago acf-internal-post-type.js 1 year ago acf.js 1 year ago
_field-group-compatibility.js
263 lines
1 ( function ( $, undefined ) {
2 var _acf = acf.getCompatibility( acf );
3
4 /**
5 * fieldGroupCompatibility
6 *
7 * Compatibility layer for extinct acf.field_group
8 *
9 * @date 15/12/17
10 * @since ACF 5.7.0
11 *
12 * @param void
13 * @return void
14 */
15
16 _acf.field_group = {
17 save_field: function ( $field, type ) {
18 type = type !== undefined ? type : 'settings';
19 acf.getFieldObject( $field ).save( type );
20 },
21
22 delete_field: function ( $field, animate ) {
23 animate = animate !== undefined ? animate : true;
24 acf.getFieldObject( $field ).delete( {
25 animate: animate,
26 } );
27 },
28
29 update_field_meta: function ( $field, name, value ) {
30 acf.getFieldObject( $field ).prop( name, value );
31 },
32
33 delete_field_meta: function ( $field, name ) {
34 acf.getFieldObject( $field ).prop( name, null );
35 },
36 };
37
38 /**
39 * fieldGroupCompatibility.field_object
40 *
41 * Compatibility layer for extinct acf.field_group.field_object
42 *
43 * @date 15/12/17
44 * @since ACF 5.7.0
45 *
46 * @param void
47 * @return void
48 */
49
50 _acf.field_group.field_object = acf.model.extend( {
51 // vars
52 type: '',
53 o: {},
54 $field: null,
55 $settings: null,
56
57 tag: function ( tag ) {
58 // vars
59 var type = this.type;
60
61 // explode, add 'field' and implode
62 // - open => open_field
63 // - change_type => change_field_type
64 var tags = tag.split( '_' );
65 tags.splice( 1, 0, 'field' );
66 tag = tags.join( '_' );
67
68 // add type
69 if ( type ) {
70 tag += '/type=' + type;
71 }
72
73 // return
74 return tag;
75 },
76
77 selector: function () {
78 // vars
79 var selector = '.acf-field-object';
80 var type = this.type;
81
82 // add type
83 if ( type ) {
84 selector += '-' + type;
85 selector = acf.str_replace( '_', '-', selector );
86 }
87
88 // return
89 return selector;
90 },
91
92 _add_action: function ( name, callback ) {
93 // vars
94 var model = this;
95
96 // add action
97 acf.add_action( this.tag( name ), function ( $field ) {
98 // focus
99 model.set( '$field', $field );
100
101 // callback
102 model[ callback ].apply( model, arguments );
103 } );
104 },
105
106 _add_filter: function ( name, callback ) {
107 // vars
108 var model = this;
109
110 // add action
111 acf.add_filter( this.tag( name ), function ( $field ) {
112 // focus
113 model.set( '$field', $field );
114
115 // callback
116 model[ callback ].apply( model, arguments );
117 } );
118 },
119
120 _add_event: function ( name, callback ) {
121 // vars
122 var model = this;
123 var event = name.substr( 0, name.indexOf( ' ' ) );
124 var selector = name.substr( name.indexOf( ' ' ) + 1 );
125 var context = this.selector();
126
127 // add event
128 $( document ).on( event, context + ' ' + selector, function ( e ) {
129 // append $el to event object
130 e.$el = $( this );
131 e.$field = e.$el.closest( '.acf-field-object' );
132
133 // focus
134 model.set( '$field', e.$field );
135
136 // callback
137 model[ callback ].apply( model, [ e ] );
138 } );
139 },
140
141 _set_$field: function () {
142 // vars
143 this.o = this.$field.data();
144
145 // els
146 this.$settings = this.$field.find( '> .settings > table > tbody' );
147
148 // focus
149 this.focus();
150 },
151
152 focus: function () {
153 // do nothing
154 },
155
156 setting: function ( name ) {
157 return this.$settings.find( '> .acf-field-setting-' + name );
158 },
159 } );
160
161 /*
162 * field
163 *
164 * This model fires actions and filters for registered fields
165 *
166 * @type function
167 * @date 21/02/2014
168 * @since ACF 3.5.1
169 *
170 * @param n/a
171 * @return n/a
172 */
173
174 var actionManager = new acf.Model( {
175 actions: {
176 open_field_object: 'onOpenFieldObject',
177 close_field_object: 'onCloseFieldObject',
178 add_field_object: 'onAddFieldObject',
179 duplicate_field_object: 'onDuplicateFieldObject',
180 delete_field_object: 'onDeleteFieldObject',
181 change_field_object_type: 'onChangeFieldObjectType',
182 change_field_object_label: 'onChangeFieldObjectLabel',
183 change_field_object_name: 'onChangeFieldObjectName',
184 change_field_object_parent: 'onChangeFieldObjectParent',
185 sortstop_field_object: 'onChangeFieldObjectParent',
186 },
187
188 onOpenFieldObject: function ( field ) {
189 acf.doAction( 'open_field', field.$el );
190 acf.doAction( 'open_field/type=' + field.get( 'type' ), field.$el );
191
192 acf.doAction( 'render_field_settings', field.$el );
193 acf.doAction(
194 'render_field_settings/type=' + field.get( 'type' ),
195 field.$el
196 );
197 },
198
199 onCloseFieldObject: function ( field ) {
200 acf.doAction( 'close_field', field.$el );
201 acf.doAction(
202 'close_field/type=' + field.get( 'type' ),
203 field.$el
204 );
205 },
206
207 onAddFieldObject: function ( field ) {
208 acf.doAction( 'add_field', field.$el );
209 acf.doAction( 'add_field/type=' + field.get( 'type' ), field.$el );
210 },
211
212 onDuplicateFieldObject: function ( field ) {
213 acf.doAction( 'duplicate_field', field.$el );
214 acf.doAction(
215 'duplicate_field/type=' + field.get( 'type' ),
216 field.$el
217 );
218 },
219
220 onDeleteFieldObject: function ( field ) {
221 acf.doAction( 'delete_field', field.$el );
222 acf.doAction(
223 'delete_field/type=' + field.get( 'type' ),
224 field.$el
225 );
226 },
227
228 onChangeFieldObjectType: function ( field ) {
229 acf.doAction( 'change_field_type', field.$el );
230 acf.doAction(
231 'change_field_type/type=' + field.get( 'type' ),
232 field.$el
233 );
234
235 acf.doAction( 'render_field_settings', field.$el );
236 acf.doAction(
237 'render_field_settings/type=' + field.get( 'type' ),
238 field.$el
239 );
240 },
241
242 onChangeFieldObjectLabel: function ( field ) {
243 acf.doAction( 'change_field_label', field.$el );
244 acf.doAction(
245 'change_field_label/type=' + field.get( 'type' ),
246 field.$el
247 );
248 },
249
250 onChangeFieldObjectName: function ( field ) {
251 acf.doAction( 'change_field_name', field.$el );
252 acf.doAction(
253 'change_field_name/type=' + field.get( 'type' ),
254 field.$el
255 );
256 },
257
258 onChangeFieldObjectParent: function ( field ) {
259 acf.doAction( 'update_field_parent', field.$el );
260 },
261 } );
262 } )( jQuery );
263