Advanced Custom Fields: Table Field - Version 1.3.1-beta2

Version Description

= 1.3.1 = * Adds support for ACF Gutenberg blocks

= 1.3.0 = * Adds support for table caption * Still supports version 4 of ACF

= 1.2.6 = Fixes an PHP error and improves JavaScript code.

Download this release

Release Info

Developer Jonua
Plugin Icon 128x128 Advanced Custom Fields: Table Field
Version 1.3.1-beta2
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1-beta2

acf-table-v4.php CHANGED
@@ -37,7 +37,7 @@
37
// settings
38
$this->settings = array(
39
'dir_url' => plugins_url( '', __FILE__ ) . '/',
40
- 'version' => '1.3.0',
41
);
42
43
// PREVENTS SAVING INVALID TABLE FIELD JSON DATA {
37
// settings
38
$this->settings = array(
39
'dir_url' => plugins_url( '', __FILE__ ) . '/',
40
+ 'version' => '1.3.1',
41
);
42
43
// PREVENTS SAVING INVALID TABLE FIELD JSON DATA {
acf-table-v5.php CHANGED
@@ -21,7 +21,7 @@ class acf_field_table extends acf_field {
21
* settings (array) Array of settings
22
*/
23
$this->settings = array(
24
- 'version' => '1.3.0',
25
'dir_url' => plugins_url( '', __FILE__ ) . '/',
26
);
27
@@ -214,8 +214,13 @@ class acf_field_table extends acf_field {
214
215
$e .= '</div>';
216
217
$e .= '<div class="acf-input-wrap">';
218
- $e .= '<input type="hidden" data-field-options="' . urlencode( wp_json_encode( $data_field ) ) . '" id="' . esc_attr( $field['id'] ) . '" class="' . esc_attr( $field['type'] ) . '" name="' . esc_attr( $field['name'] ) . '" value="' . urlencode( $field['value'] ) . '"/>';
219
$e .= '</div>';
220
221
$e .= '</div>';
@@ -406,7 +411,8 @@ class acf_field_table extends acf_field {
406
407
if ( is_string( $value ) ) {
408
409
- $value = urldecode( str_replace( '%5C', '%5C%5C', $value ) );
410
}
411
412
if ( is_array( $value ) ) {
@@ -453,6 +459,15 @@ class acf_field_table extends acf_field {
453
454
function format_value( $value, $post_id, $field ) {
455
456
$a = json_decode( $value, true );
457
458
$value = false;
21
* settings (array) Array of settings
22
*/
23
$this->settings = array(
24
+ 'version' => '1.3.1',
25
'dir_url' => plugins_url( '', __FILE__ ) . '/',
26
);
27
214
215
$e .= '</div>';
216
217
+ if ( substr( $field['value'] , 0 , 1 ) === '{' ) {
218
+
219
+ $field['value'] = urlencode( $field['value'] );
220
+ }
221
+
222
$e .= '<div class="acf-input-wrap">';
223
+ $e .= '<input type="hidden" data-field-options="' . urlencode( wp_json_encode( $data_field ) ) . '" id="' . esc_attr( $field['id'] ) . '" class="' . esc_attr( $field['type'] ) . '" name="' . esc_attr( $field['name'] ) . '" value="' . $field['value'] . '"/>';
224
$e .= '</div>';
225
226
$e .= '</div>';
411
412
if ( is_string( $value ) ) {
413
414
+ $value = str_replace( '%5C', '%5C%5C', $value );
415
+ $value = urldecode( $value );
416
}
417
418
if ( is_array( $value ) ) {
459
460
function format_value( $value, $post_id, $field ) {
461
462
+ // CHECK FOR GUTENBERG BLOCK CONTENT (URL ENCODED JSON) {
463
+
464
+ if ( substr( $value , 0 , 1 ) === '%' ) {
465
+
466
+ $value = urldecode( $value );
467
+ }
468
+
469
+ // }
470
+
471
$a = json_decode( $value, true );
472
473
$value = false;
acf-table.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Advanced Custom Fields: Table Field
4
Plugin URI: http://www.johannheyne.de/
5
Description: This free Add-on adds a table field type for the Advanced Custom Fields plugin.
6
- Version: 1.3.0
7
Author: Johann Heyne
8
Author URI: http://www.johannheyne.de/
9
License: GPLv2 or later
3
Plugin Name: Advanced Custom Fields: Table Field
4
Plugin URI: http://www.johannheyne.de/
5
Description: This free Add-on adds a table field type for the Advanced Custom Fields plugin.
6
+ Version: 1.3.1
7
Author: Johann Heyne
8
Author URI: http://www.johannheyne.de/
9
License: GPLv2 or later
changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
== Changelog ==
2
3
= 1.3.0 =
4
* Adds support for table caption
5
* Fixes a javascript issue for ACF version 4
1
== Changelog ==
2
3
+ = 1.3.1 =
4
+ * Adds support for ACF Gutenberg blocks
5
+
6
= 1.3.0 =
7
* Adds support for table caption
8
* Fixes a javascript issue for ACF version 4
js/input-v4.js CHANGED
@@ -4,7 +4,7 @@
4
5
var t = this;
6
7
- t.version = '1.3.0';
8
9
t.param = {};
10
4
5
var t = this;
6
7
+ t.version = '1.3.1';
8
9
t.param = {};
10
js/input-v5.js CHANGED
@@ -4,7 +4,7 @@
4
5
var t = this;
6
7
- t.version = '1.3.0';
8
9
t.param = {};
10
@@ -293,19 +293,49 @@
293
294
p.data = false;
295
296
if ( val !== '' ) {
297
298
try {
299
300
- p.data = $.parseJSON( decodeURIComponent( val.replace(/\+/g, '%20') ) );
301
}
302
catch (e) {
303
304
- p.data = false;
305
306
- console.log( 'The tablefield value is not a valid JSON string:', decodeURIComponent( val.replace(/\+/g, '%20') ) );
307
- console.log( 'The parsing error:', e );
308
}
309
}
310
311
return p.data;
@@ -889,7 +919,18 @@
889
890
p.data = t.update_table_data_version( p.data );
891
892
- p.obj_root.find( 'input.table' ).val( encodeURIComponent( JSON.stringify( p.data ).replace( /\\"/g, '\\"' ) ) );
893
894
// }
895
};
@@ -1182,6 +1223,14 @@
1182
1183
};
1184
1185
t.sort_cols = function( p ) {
1186
1187
p.obj_table.find('.acf-table-header-row').each( function() {
4
5
var t = this;
6
7
+ t.version = '1.3.1';
8
9
t.param = {};
10
293
294
p.data = false;
295
296
+ // CHECK FIELD CONTEXT {
297
+
298
+ if ( p.obj_root.closest( '.acf-fields' ).hasClass( 'acf-block-fields' ) ) {
299
+
300
+ p.field_context = 'block';
301
+ }
302
+ else {
303
+
304
+ p.field_context = 'box';
305
+ }
306
+
307
+ // }
308
+
309
if ( val !== '' ) {
310
311
try {
312
313
+ if ( p.field_context === 'box' ) {
314
+
315
+ p.data = $.parseJSON( decodeURIComponent( val.replace(/\+/g, '%20') ) );
316
+ }
317
+
318
+ if ( p.field_context === 'block' ) {
319
+
320
+ p.data = $.parseJSON( decodeURIComponent( decodeURIComponent( val.replace(/\+/g, '%20') ) ) );
321
+ }
322
}
323
catch (e) {
324
325
+ if ( p.field_context === 'box' ) {
326
327
+ console.log( 'The tablefield value is not a valid JSON string:', decodeURIComponent( val.replace(/\+/g, '%20') ) );
328
+ console.log( 'The parsing error:', e );
329
+ }
330
+
331
+ if ( p.field_context === 'block' ) {
332
+
333
+ console.log( 'The tablefield value is not a valid JSON string:', decodeURIComponent( decodeURIComponent( val.replace(/\+/g, '%20') ) ) );
334
+ console.log( 'The tablefield value is not a valid JSON string:', decodeURIComponent( decodeURIComponent( decodeURIComponent( val.replace(/\+/g, '%20') ) ) ) );
335
+ console.log( 'The parsing error:', e );
336
+ }
337
}
338
+
339
}
340
341
return p.data;
919
920
p.data = t.update_table_data_version( p.data );
921
922
+ // makes json string from data object
923
+ var data = JSON.stringify( p.data );
924
+
925
+ // adds backslash to all \" in JSON string because encodeURIComponent() strippes backslashes
926
+ data.replace( /\\"/g, '\\"' );
927
+
928
+ // encodes the JSON string to URI component, the format, the JSON string is saved to the database
929
+ data = encodeURIComponent( data )
930
+
931
+ p.obj_root.find( 'input.table' ).val( data );
932
+
933
+ t.field_changed( p );
934
935
// }
936
};
1223
1224
};
1225
1226
+ t.field_changed = function( p ) {
1227
+
1228
+ if ( p.field_context === 'block' ) {
1229
+
1230
+ p.obj_root.change();
1231
+ }
1232
+ };
1233
+
1234
t.sort_cols = function( p ) {
1235
1236
p.obj_table.find('.acf-table-header-row').each( function() {
lang/acf-table-da_DK.po CHANGED
@@ -38,10 +38,10 @@ msgid ""
38
msgstr ""
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
- #. Fields: Table Field 1.3.0) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
- #. Fields: Table Field 1.3.0) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
38
msgstr ""
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
lang/acf-table-de_DE.po CHANGED
@@ -38,10 +38,10 @@ msgstr ""
38
"Tabellen Feldtype hinzu."
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
- #. Fields: Table Field 1.3.0) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
- #. Fields: Table Field 1.3.0) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
38
"Tabellen Feldtype hinzu."
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
lang/acf-table-pl_PL.po CHANGED
@@ -36,10 +36,10 @@ msgid ""
36
msgstr ""
37
38
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
39
- #. Fields: Table Field 1.3.0) #-#-#-#-#
40
#. Plugin URI of the plugin/theme
41
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
42
- #. Fields: Table Field 1.3.0) #-#-#-#-#
43
#. Author URI of the plugin/theme
44
msgid "http://www.johannheyne.de/"
45
msgstr ""
36
msgstr ""
37
38
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
39
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
40
#. Plugin URI of the plugin/theme
41
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
42
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
43
#. Author URI of the plugin/theme
44
msgid "http://www.johannheyne.de/"
45
msgstr ""
lang/acf-table.pot CHANGED
@@ -32,10 +32,10 @@ msgid "This free Add-on adds a table field type for the Advanced Custom Fields p
32
msgstr ""
33
34
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
35
- #. Fields: Table Field 1.3.0) #-#-#-#-#
36
#. Plugin URI of the plugin/theme
37
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
38
- #. Fields: Table Field 1.3.0) #-#-#-#-#
39
#. Author URI of the plugin/theme
40
msgid "http://www.johannheyne.de/"
41
msgstr ""
32
msgstr ""
33
34
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
35
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
36
#. Plugin URI of the plugin/theme
37
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
38
+ #. Fields: Table Field 1.3.1) #-#-#-#-#
39
#. Author URI of the plugin/theme
40
msgid "http://www.johannheyne.de/"
41
msgstr ""
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
=== Advanced Custom Fields: Table Field ===
2
Contributors: jonua
3
Tags: acf table
4
- Requires at least: 4.9
5
- Tested up to: 4.9.8
6
Stable tag: 1.2.6
7
Requires PHP: 5.6
8
License: GPLv2 or later
@@ -20,6 +20,7 @@ The table field works also with the repeater and flexible field types.
20
= Features =
21
* Table Header (Option)
22
* Table Caption (Option)
23
* Add and remove table columns and rows
24
* Change order of columns and rows by dragging
25
* To move to the next cells editor press key: tab
@@ -244,6 +245,9 @@ However, only when activated as a plugin will updates be available.
244
245
== Upgrade Notice ==
246
247
= 1.3.0 =
248
* Adds support for table caption
249
* Still supports version 4 of ACF
@@ -254,6 +258,9 @@ Fixes an PHP error and improves JavaScript code.
254
255
== Changelog ==
256
257
= 1.3.0 =
258
* Adds support for table caption
259
* Fixes a javascript issue for ACF version 4
1
=== Advanced Custom Fields: Table Field ===
2
Contributors: jonua
3
Tags: acf table
4
+ Requires at least: 5.0.3
5
+ Tested up to: 5.0.3
6
Stable tag: 1.2.6
7
Requires PHP: 5.6
8
License: GPLv2 or later
20
= Features =
21
* Table Header (Option)
22
* Table Caption (Option)
23
+ * Support for ACF Gutenberg blocks
24
* Add and remove table columns and rows
25
* Change order of columns and rows by dragging
26
* To move to the next cells editor press key: tab
245
246
== Upgrade Notice ==
247
248
+ = 1.3.1 =
249
+ * Adds support for ACF Gutenberg blocks
250
+
251
= 1.3.0 =
252
* Adds support for table caption
253
* Still supports version 4 of ACF
258
259
== Changelog ==
260
261
+ = 1.3.1 =
262
+ * Adds support for ACF Gutenberg blocks
263
+
264
= 1.3.0 =
265
* Adds support for table caption
266
* Fixes a javascript issue for ACF version 4