Advanced Custom Fields: Extended - Version 0.5.2

Version Description

  • Fields: Added new dynamic message field
  • Fields: Added new button field
  • General: Added compatibility filters for 'Post Types Order' plugin
  • Plugin: Updated assets
  • Plugin: Reworked readme
  • Plugin: Fixed typos
Download this release

Release Info

Developer hwk-fr
Plugin Icon 128x128 Advanced Custom Fields: Extended
Version 0.5.2
Comparing to
See all releases

Code changes from version 0.5.1 to 0.5.2

acf-extended.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Advanced Custom Fields: Extended
4
  * Description: Enhancement Suite which improves Advanced Custom Fields administration
5
- * Version: 0.5.1
6
  * Author: hwk-fr
7
  * Author URI: https://hwk.fr
8
  * Text Domain: acfe
@@ -50,18 +50,18 @@ function acfe_init(){
50
  /**
51
  * Core
52
  */
 
53
  require_once(ACFE_PATH . 'includes/core/enqueue.php');
54
  require_once(ACFE_PATH . 'includes/core/helpers.php');
55
 
56
  /**
57
- * Settings
58
  */
59
  require_once(ACFE_PATH . 'includes/admin/settings.php');
60
 
61
  /**
62
- * Fields
63
  */
64
- require_once(ACFE_PATH . 'includes/fields/field-dynamic-message.php');
65
  require_once(ACFE_PATH . 'includes/fields/settings-data.php');
66
  require_once(ACFE_PATH . 'includes/fields/settings-permissions.php');
67
  require_once(ACFE_PATH . 'includes/fields/settings-update.php');
@@ -79,4 +79,10 @@ function acfe_init(){
79
  */
80
  require_once(ACFE_PATH . 'includes/modules/autosync.php');
81
 
82
- }
 
 
 
 
 
 
2
  /**
3
  * Plugin Name: Advanced Custom Fields: Extended
4
  * Description: Enhancement Suite which improves Advanced Custom Fields administration
5
+ * Version: 0.5.2
6
  * Author: hwk-fr
7
  * Author URI: https://hwk.fr
8
  * Text Domain: acfe
50
  /**
51
  * Core
52
  */
53
+ require_once(ACFE_PATH . 'includes/core/compatibility.php');
54
  require_once(ACFE_PATH . 'includes/core/enqueue.php');
55
  require_once(ACFE_PATH . 'includes/core/helpers.php');
56
 
57
  /**
58
+ * ACF Settings
59
  */
60
  require_once(ACFE_PATH . 'includes/admin/settings.php');
61
 
62
  /**
63
+ * Fields settings
64
  */
 
65
  require_once(ACFE_PATH . 'includes/fields/settings-data.php');
66
  require_once(ACFE_PATH . 'includes/fields/settings-permissions.php');
67
  require_once(ACFE_PATH . 'includes/fields/settings-update.php');
79
  */
80
  require_once(ACFE_PATH . 'includes/modules/autosync.php');
81
 
82
+ }
83
+
84
+ /**
85
+ * Fields
86
+ */
87
+ require_once(ACFE_PATH . 'includes/fields/field-button.php');
88
+ require_once(ACFE_PATH . 'includes/fields/field-dynamic-message.php');
includes/core/compatibility.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ /**
7
+ * Plugin: Post Types Order
8
+ * https://wordpress.org/plugins/post-types-order/
9
+ * The plugin apply custom order to 'acf-field-group' Post Type. We have to fix this
10
+ */
11
+ add_filter('pto/posts_orderby/ignore', 'acfe_compatibility_pto_acf_field_group', 10, 3);
12
+ function acfe_compatibility_pto_acf_field_group($ignore, $orderby, $query){
13
+ if(is_admin() && $query->is_main_query() && $query->get('post_type') == 'acf-field-group')
14
+ $ignore = true;
15
+
16
+ return $ignore;
17
+ }
includes/field-groups/field-group.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH'))
4
  exit;
5
 
6
  /**
7
- * Field Group Options: Native Note
8
  */
9
  add_action('acf/render_field_group_settings', 'acfe_render_field_group_options');
10
  function acfe_render_field_group_options($field_group){
@@ -165,7 +165,7 @@ function acfe_render_field_group_settings_side(){
165
 
166
  acf_render_field_wrap(array(
167
  'label' => __('Auto Sync'),
168
- 'instructions' => __('Synchronize field group upon update'),
169
  'type' => 'checkbox',
170
  'name' => 'acfe_autosync',
171
  'prefix' => 'acf_field_group',
@@ -301,16 +301,7 @@ function acfe_render_field_group_data($field){
301
  }
302
 
303
  /**
304
- * Default: Label placement - Left
305
- */
306
- add_filter('acf/validate_field_group', 'acfc_field_group_options');
307
- function acfc_field_group_options($field_group){
308
- $field_group['label_placement'] = 'left';
309
- return $field_group;
310
- }
311
-
312
- /**
313
- * Field Group Title (post edit)
314
  */
315
  add_filter('acf/get_field_groups', 'acfe_render_field_groups', 999);
316
  function acfe_render_field_groups($field_groups){
@@ -334,7 +325,7 @@ function acfe_render_field_groups($field_groups){
334
  }
335
 
336
  /**
337
- * Field Group Permissions (post edit)
338
  */
339
  add_filter('acf/get_field_groups', 'acfe_permissions_field_groups', 999);
340
  function acfe_permissions_field_groups($field_groups){
@@ -373,4 +364,41 @@ function acfe_permissions_field_groups($field_groups){
373
  }
374
 
375
  return $field_groups;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  }
4
  exit;
5
 
6
  /**
7
+ * Field Group Options: Note
8
  */
9
  add_action('acf/render_field_group_settings', 'acfe_render_field_group_options');
10
  function acfe_render_field_group_options($field_group){
165
 
166
  acf_render_field_wrap(array(
167
  'label' => __('Auto Sync'),
168
+ 'instructions' => '',
169
  'type' => 'checkbox',
170
  'name' => 'acfe_autosync',
171
  'prefix' => 'acf_field_group',
301
  }
302
 
303
  /**
304
+ * Hooks: Display title (post edit)
 
 
 
 
 
 
 
 
 
305
  */
306
  add_filter('acf/get_field_groups', 'acfe_render_field_groups', 999);
307
  function acfe_render_field_groups($field_groups){
325
  }
326
 
327
  /**
328
+ * Hooks: Permissions (post edit)
329
  */
330
  add_filter('acf/get_field_groups', 'acfe_permissions_field_groups', 999);
331
  function acfe_permissions_field_groups($field_groups){
364
  }
365
 
366
  return $field_groups;
367
+ }
368
+
369
+ /**
370
+ * Hooks: Default label placement - Left
371
+ */
372
+ add_filter('acf/validate_field_group', 'acfc_field_group_default_options');
373
+ function acfc_field_group_default_options($field_group){
374
+ $field_group['label_placement'] = 'left';
375
+ return $field_group;
376
+ }
377
+
378
+ /**
379
+ * Hooks: Locations - Post Type - All (Values)
380
+ */
381
+ add_filter('acf/location/rule_values/post_type', 'acfc_field_group_locations_values_post_type_all');
382
+ function acfc_field_group_locations_values_post_type_all($choices){
383
+ $choices = array_merge(array('all' => __('All')), $choices);
384
+ return $choices;
385
+ }
386
+
387
+ /**
388
+ * Hooks: Locations - Post Type - All (Match)
389
+ */
390
+ add_filter('acf/location/rule_match', 'acfc_field_group_locations_match_post_type_all', 10, 3);
391
+ function acfc_field_group_locations_match_post_type_all($match, $rule, $options){
392
+ if($rule['param'] != 'post_type' || $rule['value'] != 'all')
393
+ return $match;
394
+
395
+ if($rule['operator'] == "=="){
396
+ $match = isset($options['post_type']) && !empty($options['post_type']);
397
+ }
398
+
399
+ elseif($rule['operator'] == "!="){
400
+ $match = !isset($options['post_type']) || empty($options['post_type']);
401
+ }
402
+
403
+ return $match;
404
  }
includes/field-groups/field-groups.php CHANGED
@@ -248,6 +248,7 @@ function acfe_field_groups_column_html($column, $post_id){
248
 
249
  }
250
  }
 
251
  /**
252
  * Table Row Actions
253
  */
@@ -265,19 +266,10 @@ function hwk_post_type_exemple_row_actions($actions, $post){
265
  return $actions;
266
  }
267
 
268
- //add_filter('acf/validate_field_group', 'acfe_test_local_fg', 999);
269
- function acfe_test_local_fg($field_group){
270
-
271
- error_log(print_r($field_group, true));
272
- //_print_r($field_group);
273
-
274
- return $field_group;
275
- }
276
-
277
  /**
278
  * Sidebar
279
  */
280
- add_action('current_screen',function(){
281
  if(!acf_is_screen('edit-acf-field-group'))
282
  return;
283
 
@@ -319,4 +311,12 @@ add_action('current_screen',function(){
319
  </script>
320
  <?php
321
  });
322
- });
 
 
 
 
 
 
 
 
248
 
249
  }
250
  }
251
+
252
  /**
253
  * Table Row Actions
254
  */
266
  return $actions;
267
  }
268
 
 
 
 
 
 
 
 
 
 
269
  /**
270
  * Sidebar
271
  */
272
+ add_action('current_screen', function(){
273
  if(!acf_is_screen('edit-acf-field-group'))
274
  return;
275
 
311
  </script>
312
  <?php
313
  });
314
+ });
315
+
316
+ /**
317
+ * Hooks: Posts per page
318
+ */
319
+ add_filter('edit_acf-field-group_per_page', 'acfe_field_groups_posts_per_page');
320
+ function acfe_field_groups_posts_per_page(){
321
+ return 999;
322
+ }
includes/fields/field-button.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if(!defined('ABSPATH'))
4
+ exit;
5
+
6
+ add_action('acf/include_field_types', function(){
7
+
8
+ class acfe_field_button extends acf_field{
9
+
10
+ function __construct(){
11
+
12
+ $this->name = 'button';
13
+ $this->label = __('Button', 'acfe');
14
+ $this->category = 'basic';
15
+
16
+ parent::__construct();
17
+
18
+ }
19
+
20
+ function render_field_settings($field){
21
+
22
+ acf_render_field_setting($field, array(
23
+ 'label' => __('Button value', 'acfe'),
24
+ 'instructions' => __('Set a default value for the field', 'acfe'),
25
+ 'type' => 'text',
26
+ 'name' => 'button_value',
27
+ 'default_value' => __('Submit', 'acfe')
28
+ ));
29
+
30
+ acf_render_field_setting($field, array(
31
+ 'label' => __('Button attributes', 'acfe'),
32
+ 'instructions' => __('Set button attributes', 'acfe'),
33
+ 'type' => 'group',
34
+ 'name' => 'button_attributes',
35
+ 'sub_fields' => array(
36
+ array(
37
+ 'label' => '',
38
+ 'instructions' => '',
39
+ 'type' => 'select',
40
+ 'name' => 'button_type',
41
+ '_name' => 'button_type',
42
+ 'key' => 'button_type',
43
+ 'required' => false,
44
+ 'default_value' => 'button',
45
+ 'choices' => array(
46
+ 'button' => __('Button', 'acfe'),
47
+ 'submit' => __('Submit', 'acfe'),
48
+ ),
49
+ 'wrapper' => array(
50
+ 'width' => 33
51
+ )
52
+ ),
53
+
54
+ array(
55
+ 'label' => '',
56
+ 'instructions' => '',
57
+ 'type' => 'text',
58
+ 'name' => 'button_class',
59
+ '_name' => 'button_class',
60
+ 'key' => 'button_class',
61
+ 'required' => false,
62
+ 'prepend' => 'class',
63
+ 'wrapper' => array(
64
+ 'width' => 33
65
+ )
66
+ ),
67
+
68
+ array(
69
+ 'label' => '',
70
+ 'instructions' => '',
71
+ 'type' => 'text',
72
+ 'name' => 'button_id',
73
+ '_name' => 'button_id',
74
+ 'key' => 'button_id',
75
+ 'required' => false,
76
+ 'prepend' => 'id',
77
+ 'wrapper' => array(
78
+ 'width' => 33
79
+ )
80
+ ),
81
+
82
+
83
+ )
84
+ ));
85
+
86
+ acf_render_field_setting($field, array(
87
+ 'label' => __('Button wrapper', 'acfe'),
88
+ 'instructions' => __('Set button wrapper', 'acfe'),
89
+ 'type' => 'group',
90
+ 'name' => 'button_wrapper',
91
+ 'sub_fields' => array(
92
+
93
+ array(
94
+ 'label' => '',
95
+ 'instructions' => '',
96
+ 'type' => 'text',
97
+ 'name' => 'button_before',
98
+ '_name' => 'button_before',
99
+ 'key' => 'button_before',
100
+ 'required' => false,
101
+ 'prepend' => __('Before'),
102
+ 'wrapper' => array(
103
+ 'width' => 50
104
+ )
105
+ ),
106
+
107
+ array(
108
+ 'label' => '',
109
+ 'instructions' => '',
110
+ 'type' => 'text',
111
+ 'name' => 'button_after',
112
+ '_name' => 'button_after',
113
+ 'key' => 'button_after',
114
+ 'required' => false,
115
+ 'prepend' => __('After'),
116
+ 'wrapper' => array(
117
+ 'width' => 50
118
+ )
119
+ ),
120
+
121
+
122
+ )
123
+ ));
124
+
125
+ }
126
+
127
+ function render_field($field){
128
+
129
+ if(!empty($field['button_wrapper']['button_before'])){
130
+ echo $field['button_wrapper']['button_before'];
131
+ }
132
+
133
+ echo '<input
134
+ type="' . esc_attr($field['button_attributes']['button_type']) . '"
135
+ name="' . esc_attr($field['name']) . '"
136
+ id="' . esc_attr($field['button_attributes']['button_id']) . '"
137
+ class="' . esc_attr($field['button_attributes']['button_class']) . '"
138
+ value="' . esc_attr($field['button_value']) . '"
139
+ />';
140
+
141
+ if(!empty($field['button_wrapper']['button_after'])){
142
+ echo $field['button_wrapper']['button_after'];
143
+ }
144
+
145
+ }
146
+
147
+ }
148
+
149
+ new acfe_field_button();
150
+
151
+ });
includes/fields/field-dynamic-message.php CHANGED
@@ -11,14 +11,12 @@ add_action('acf/include_field_types', function(){
11
  $this->name = 'acfe_dynamic_message';
12
  $this->label = __('Dynamic Message', 'acfe');
13
  $this->category = 'layout';
14
-
15
- // do not delete!
16
  parent::__construct();
17
  }
18
 
19
  }
20
 
21
- // create field
22
  new acfe_field_dynamic_message();
23
 
24
  });
11
  $this->name = 'acfe_dynamic_message';
12
  $this->label = __('Dynamic Message', 'acfe');
13
  $this->category = 'layout';
14
+
 
15
  parent::__construct();
16
  }
17
 
18
  }
19
 
 
20
  new acfe_field_dynamic_message();
21
 
22
  });
readme.txt CHANGED
@@ -5,84 +5,93 @@ Tags: acf, custom fields, meta, admin, fields, form, repeater, content
5
  Requires at least: 4.9
6
  Tested up to: 5.1.1
7
  Requires PHP: 5.6
8
- Stable tag: 0.5.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Enhancement Suite which improves Advanced Custom Fields administration
13
 
14
  == Description ==
15
 
16
- **Advanced Custom Fields: Extended requires at least ACF Pro 5.7.10**
17
 
18
- == Features: Field Groups ==
19
 
20
- **Auto Sync PHP**
21
- Automatically synchronize field groups with local PHP files upon field group updates. This feature will create, include and update a local PHP file for each field group (just like the native Json sync feature).
 
22
 
 
 
23
  Default folder: `/wp-content/themes/my-theme/acfe-php/`
24
 
25
- **Auto Sync Json**
26
  Control which field groups you want to synchronize with local Json files. Display warnings if the Json file has been manually deleted. Manually synchronize Json from field group screen.
27
 
28
- **Categories**
29
  Spice up your field groups with a custom taxonomy and filter field groups by terms.
30
 
31
- **Permissions**
32
- Add permission layer in field groups. Choose which roles can view & edit field groups in the post edition screen.
33
 
34
- **Alternative Title**
35
  Display an alternative field group title in post edition screen.
36
 
37
- **Note**
38
  Add a personal note in the field group administration. Only visible to administrators
39
 
40
- **Custom meta data**
41
  Add custom metas (key/value) in the field group administration
42
 
43
- **View raw data**
44
  Display raw field group data in a modal to check your configuration & settings
45
 
46
- **Custom key**
47
  Set custom field group key. ie: `group_custom_name`
48
 
49
- == Features: Field Groups List ==
50
 
51
- **Column: Category**
52
  Display and filter field groups categories
53
 
54
- **Column: Locations**
55
  Quick view of field groups locations informations using icons & popover
56
 
57
- **Column: Load**
58
  Quick view of field groups load engine (DB or PHP. See Sync PHP)
59
 
60
- **Column: Sync PHP / Json**
61
  Quick view of field groups synchronization status with warnings
62
 
63
- **Row action: Export PHP / Json**
64
  One-click export for each field groups
65
 
66
- **Row action: Field group key**
67
  Quick view of field groups keys
68
 
69
- == Features: Fields ==
70
 
71
- **Avanced validation**
72
  A more sophisticated validation conditions (AND/OR) with custom error messages in the post edition screen.
73
 
74
- **Advanced update filter**
75
  Add specific PHP filters right before the value is saved in the database.
76
 
77
- **Permissions**
78
- Add permission layer in fields. Choose which roles can view & edit fields in the post edition screen. (can be combinated with field groups permissions)
79
 
80
- **View raw data**
81
  Display raw field data in a modal to check your configuration & settings
82
 
83
- == Features: Settings ==
 
84
 
85
- **Settings page**
 
 
 
 
 
86
  Display all ACF settings in one page
87
 
88
  == Installation ==
@@ -113,6 +122,14 @@ Create a folder `/acfe-php/` in your theme. Go to your field group administratio
113
 
114
  == Changelog ==
115
 
 
 
 
 
 
 
 
 
116
  = 0.5.1 =
117
  * Plugin: Added screenshots
118
  * Field Group: Moved Auto Sync Warnings below Auto Sync instructions
5
  Requires at least: 4.9
6
  Tested up to: 5.1.1
7
  Requires PHP: 5.6
8
+ Stable tag: 0.5.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ All-in-one enhancement suite which improves Advanced Custom Fields administration.
13
 
14
  == Description ==
15
 
16
+ ACF Extended is a all-in-one enhancement suite which improves Advanced Custom Fields administration.
17
 
18
+ **Requires at least ACF Pro 5.7.10**
19
 
20
+ *If you don't already own [ACF Pro](https://www.advancedcustomfields.com/pro/), I can only advise you to seriously consider it. It's one of the most powerful WordPress plugin, with a life-time licence for unlimited websites. What more could anyone want?*
21
+
22
+ == Field Groups ==
23
 
24
+ * **Auto Sync PHP**
25
+ Automatically synchronize field groups with local PHP files upon field group updates. This feature will create, include and update a local PHP file for each field group (just like the native Json sync feature).
26
  Default folder: `/wp-content/themes/my-theme/acfe-php/`
27
 
28
+ * **Auto Sync Json**
29
  Control which field groups you want to synchronize with local Json files. Display warnings if the Json file has been manually deleted. Manually synchronize Json from field group screen.
30
 
31
+ * **Categories**
32
  Spice up your field groups with a custom taxonomy and filter field groups by terms.
33
 
34
+ * **Permissions**
35
+ Add permission layer to field groups. Choose which roles can view & edit field groups in the post edition screen.
36
 
37
+ * **Alternative Title**
38
  Display an alternative field group title in post edition screen.
39
 
40
+ * **Note**
41
  Add a personal note in the field group administration. Only visible to administrators
42
 
43
+ * **Custom meta data**
44
  Add custom metas (key/value) in the field group administration
45
 
46
+ * **View raw data**
47
  Display raw field group data in a modal to check your configuration & settings
48
 
49
+ * **Custom key**
50
  Set custom field group key. ie: `group_custom_name`
51
 
52
+ == Field Groups List ==
53
 
54
+ * **Column: Category**
55
  Display and filter field groups categories
56
 
57
+ * **Column: Locations**
58
  Quick view of field groups locations informations using icons & popover
59
 
60
+ * **Column: Load**
61
  Quick view of field groups load engine (DB or PHP. See Sync PHP)
62
 
63
+ * **Column: Sync PHP / Json**
64
  Quick view of field groups synchronization status with warnings
65
 
66
+ * **Row action: Export PHP / Json**
67
  One-click export for each field groups
68
 
69
+ * **Row action: Field group key**
70
  Quick view of field groups keys
71
 
72
+ == Fields ==
73
 
74
+ * **Advanced validation**
75
  A more sophisticated validation conditions (AND/OR) with custom error messages in the post edition screen.
76
 
77
+ * **Advanced update filter**
78
  Add specific PHP filters right before the value is saved in the database.
79
 
80
+ * **Permissions**
81
+ Add permission layer to fields. Choose which roles can view & edit fields in the post edition screen. (can be combinated with field groups permissions)
82
 
83
+ * **View raw data**
84
  Display raw field data in a modal to check your configuration & settings
85
 
86
+ * **New field: Dynamic message**
87
+ Display dynamic PHP content using `acf/render_field`
88
 
89
+ * **New field: Button**
90
+ Display a submit button
91
+
92
+ == ACF Settings ==
93
+
94
+ * **Settings page**
95
  Display all ACF settings in one page
96
 
97
  == Installation ==
122
 
123
  == Changelog ==
124
 
125
+ = 0.5.2 =
126
+ * Fields: Added new dynamic message field
127
+ * Fields: Added new button field
128
+ * General: Added compatibility filters for 'Post Types Order' plugin
129
+ * Plugin: Updated assets
130
+ * Plugin: Reworked readme
131
+ * Plugin: Fixed typos
132
+
133
  = 0.5.1 =
134
  * Plugin: Added screenshots
135
  * Field Group: Moved Auto Sync Warnings below Auto Sync instructions