Advanced Custom Fields: Font Awesome Field - Version 1.7.4

Version Description

  • Fixed incompatibilities with latest ACF 5 + Select2 v4.x
Download this release

Release Info

Developer mattkeys
Plugin Icon 128x128 Advanced Custom Fields: Font Awesome Field
Version 1.7.4
Comparing to
See all releases

Code changes from version 1.7.3 to 1.7.4

Files changed (27) hide show
  1. acf-font-awesome-v4.php +4 -1
  2. acf-font-awesome-v5.php +9 -4
  3. acf-font-awesome.php +1 -1
  4. better-font-awesome-library/README.md +0 -0
  5. better-font-awesome-library/better-font-awesome-library.php +0 -0
  6. better-font-awesome-library/css/admin-styles.css +0 -0
  7. better-font-awesome-library/js/admin.js +0 -0
  8. better-font-awesome-library/lib/fallback-font-awesome/README.md +0 -0
  9. better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.css +0 -0
  10. better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.css.map +0 -0
  11. better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.min.css +0 -0
  12. better-font-awesome-library/lib/fallback-font-awesome/fonts/FontAwesome.otf +0 -0
  13. better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.eot +0 -0
  14. better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.svg +0 -0
  15. better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  16. better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.woff +0 -0
  17. better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  18. better-font-awesome-library/lib/fallback-font-awesome/package.json +0 -0
  19. better-font-awesome-library/lib/fontawesome-iconpicker/css/fontawesome-iconpicker.css +0 -0
  20. better-font-awesome-library/lib/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css +0 -0
  21. better-font-awesome-library/lib/fontawesome-iconpicker/js/fontawesome-iconpicker.js +0 -0
  22. better-font-awesome-library/lib/fontawesome-iconpicker/js/fontawesome-iconpicker.min.js +0 -0
  23. css/input.css +2 -0
  24. js/create_input.js +32 -18
  25. js/edit_input.js +3 -3
  26. js/select2/select2_locale_zh-TW.js +0 -0
  27. readme.txt +7 -1
acf-font-awesome-v4.php CHANGED
@@ -33,7 +33,7 @@ class acf_field_font_awesome extends acf_field
33
  $this->settings = array(
34
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
35
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
36
- 'version' => '1.5'
37
  );
38
 
39
  add_filter('acf/load_field', array( $this, 'maybe_enqueue_font_awesome' ) );
@@ -330,6 +330,9 @@ class acf_field_font_awesome extends acf_field
330
  // register acf scripts
331
  wp_enqueue_script('font-awesome-select2', $this->settings['dir'] . 'js/select2/select2.min.js', array(), $this->settings['version']);
332
  wp_enqueue_script('font-awesome-create-input', $this->settings['dir'] . 'js/create_input.js', array(), $this->settings['version']);
 
 
 
333
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
334
  wp_enqueue_style('acf-input-font-awesome-fa', $this->stylesheet, array(), $this->version);
335
  wp_enqueue_style('acf-input-font-awesome-select2-css', $this->settings['dir'] . 'css/select2.css', array(), $this->settings['version']);
33
  $this->settings = array(
34
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
35
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
36
+ 'version' => '1.74'
37
  );
38
 
39
  add_filter('acf/load_field', array( $this, 'maybe_enqueue_font_awesome' ) );
330
  // register acf scripts
331
  wp_enqueue_script('font-awesome-select2', $this->settings['dir'] . 'js/select2/select2.min.js', array(), $this->settings['version']);
332
  wp_enqueue_script('font-awesome-create-input', $this->settings['dir'] . 'js/create_input.js', array(), $this->settings['version']);
333
+ wp_localize_script( 'font-awesome-create-input', 'ACFFA', array(
334
+ 'version' => 4
335
+ ));
336
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
337
  wp_enqueue_style('acf-input-font-awesome-fa', $this->stylesheet, array(), $this->version);
338
  wp_enqueue_style('acf-input-font-awesome-select2-css', $this->settings['dir'] . 'css/select2.css', array(), $this->settings['version']);
acf-font-awesome-v5.php CHANGED
@@ -36,7 +36,7 @@ class acf_field_font_awesome extends acf_field {
36
  $this->settings = array(
37
  'path' => dirname(__FILE__),
38
  'dir' => $this->helpers_get_dir( __FILE__ ),
39
- 'version' => '1.5'
40
  );
41
 
42
  add_filter('acf/load_field', array( $this, 'maybe_enqueue_font_awesome' ) );
@@ -134,7 +134,7 @@ class acf_field_font_awesome extends acf_field {
134
  */
135
 
136
  acf_render_field_setting( $field, array(
137
- 'label' => __('Live Preview','acf-font-awesome'),
138
  'instructions' => '',
139
  'type' => 'message',
140
  'name' => 'fa_live_preview',
@@ -147,7 +147,9 @@ class acf_field_font_awesome extends acf_field {
147
  'type' => 'select',
148
  'name' => 'default_value',
149
  'class' => 'fontawesome',
150
- 'choices' => $field['choices']
 
 
151
  ));
152
 
153
  acf_render_field_setting( $field, array(
@@ -229,7 +231,7 @@ class acf_field_font_awesome extends acf_field {
229
  echo '<div class="fa-field-wrapper">';
230
  echo '<div class="fa-live-preview"></div>';
231
  echo '<select id="' . $field['id'] . '" class="' . $field['class'] . ' fa-select2-field" name="' . $field['name'] . '" >';
232
-
233
  // null
234
  if( $field['allow_null'] )
235
  {
@@ -320,6 +322,9 @@ class acf_field_font_awesome extends acf_field {
320
 
321
  // register acf scripts
322
  wp_enqueue_script('font-awesome-create-input', $this->settings['dir'] . 'js/create_input.js', array(), $this->settings['version']);
 
 
 
323
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
324
  wp_enqueue_style('acf-input-font-awesome-fa', $this->stylesheet, array(), $this->version);
325
  }
36
  $this->settings = array(
37
  'path' => dirname(__FILE__),
38
  'dir' => $this->helpers_get_dir( __FILE__ ),
39
+ 'version' => '1.74'
40
  );
41
 
42
  add_filter('acf/load_field', array( $this, 'maybe_enqueue_font_awesome' ) );
134
  */
135
 
136
  acf_render_field_setting( $field, array(
137
+ 'label' => __('Icon Preview','acf-font-awesome'),
138
  'instructions' => '',
139
  'type' => 'message',
140
  'name' => 'fa_live_preview',
147
  'type' => 'select',
148
  'name' => 'default_value',
149
  'class' => 'fontawesome',
150
+ 'choices' => $field['choices'],
151
+ 'placeholder' => 'Choose',
152
+ 'ui' => 1
153
  ));
154
 
155
  acf_render_field_setting( $field, array(
231
  echo '<div class="fa-field-wrapper">';
232
  echo '<div class="fa-live-preview"></div>';
233
  echo '<select id="' . $field['id'] . '" class="' . $field['class'] . ' fa-select2-field" name="' . $field['name'] . '" >';
234
+
235
  // null
236
  if( $field['allow_null'] )
237
  {
322
 
323
  // register acf scripts
324
  wp_enqueue_script('font-awesome-create-input', $this->settings['dir'] . 'js/create_input.js', array(), $this->settings['version']);
325
+ wp_localize_script( 'font-awesome-create-input', 'ACFFA', array(
326
+ 'version' => 5
327
+ ));
328
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
329
  wp_enqueue_style('acf-input-font-awesome-fa', $this->stylesheet, array(), $this->version);
330
  }
acf-font-awesome.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Advanced Custom Fields: Font Awesome
4
  Description: Add a Font Awesome field type to Advanced Custom Fields
5
- Version: 1.7.3
6
  Author: Matt Keys
7
  Author URI: http://mattkeys.me/
8
  License: GPLv2 or later
2
  /*
3
  Plugin Name: Advanced Custom Fields: Font Awesome
4
  Description: Add a Font Awesome field type to Advanced Custom Fields
5
+ Version: 1.7.4
6
  Author: Matt Keys
7
  Author URI: http://mattkeys.me/
8
  License: GPLv2 or later
better-font-awesome-library/README.md CHANGED
File without changes
better-font-awesome-library/better-font-awesome-library.php CHANGED
File without changes
better-font-awesome-library/css/admin-styles.css CHANGED
File without changes
better-font-awesome-library/js/admin.js CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/README.md CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.css CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.css.map CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.min.css CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/FontAwesome.otf CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.eot CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.svg CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.ttf CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.woff CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.woff2 CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/package.json CHANGED
File without changes
better-font-awesome-library/lib/fontawesome-iconpicker/css/fontawesome-iconpicker.css CHANGED
File without changes
better-font-awesome-library/lib/fontawesome-iconpicker/css/fontawesome-iconpicker.min.css CHANGED
File without changes
better-font-awesome-library/lib/fontawesome-iconpicker/js/fontawesome-iconpicker.js CHANGED
File without changes
better-font-awesome-library/lib/fontawesome-iconpicker/js/fontawesome-iconpicker.min.js CHANGED
File without changes
css/input.css CHANGED
@@ -13,6 +13,8 @@
13
 
14
  .fa-field-wrapper .select2-drop,
15
  .fa-field-wrapper .select2-chosen,
 
 
16
  .select2-container.fontawesome,
17
  .fa-select2-drop {
18
  font-family: 'FontAwesome', 'Open Sans', sans-serif;
13
 
14
  .fa-field-wrapper .select2-drop,
15
  .fa-field-wrapper .select2-chosen,
16
+ .fa-field-wrapper .select2-selection__rendered,
17
+ .acf-field-object-font-awesome .select2-selection__rendered,
18
  .select2-container.fontawesome,
19
  .fa-select2-drop {
20
  font-family: 'FontAwesome', 'Open Sans', sans-serif;
js/create_input.js CHANGED
@@ -1,18 +1,19 @@
1
  (function($){
2
 
3
- var version_num = 5;
4
 
5
  $(document).on( 'change', '.field_type-select select, .field_type select, .acf-field-select select', function() {
6
 
7
  if ( $(this).val() == 'font-awesome' ) {
8
 
9
- // ACF 5
10
- var font_awesome_form = $(this).closest( '.acf-field-object-font-awesome' );
11
 
12
- // ACF 4
13
- if ( font_awesome_form.length === 0 ) {
 
 
 
14
  font_awesome_form = $(this).closest( '.field_form' );
15
- version_num = 4;
16
  }
17
 
18
  setTimeout(function() {
@@ -37,32 +38,45 @@
37
 
38
  });
39
 
40
- $(document).ready(function($) {
41
-
42
- if ( $('.fa-field-wrapper').length > 0 ) {
43
- version_num = 4;
44
- }
 
 
 
 
 
 
 
45
 
 
 
46
  elements = $( 'select.fontawesome' );
47
 
48
- $( elements ).select2({
49
- width : '100%',
50
- dropdownCssClass : 'fa-select2-drop'
51
- });
 
 
 
52
  $.each( elements , function( index, el ) {
53
  update_preview( el, $(el).val(), version_num );
54
  });
 
55
  });
56
 
57
- $(document).on( 'select2-selecting', 'select.fontawesome', function( object ) {
58
  update_preview( this, object.val, version_num );
59
  });
60
 
61
- $(document).on( 'select2-highlight', 'select.fontawesome', function( object ) {
62
  update_preview( this, object.val, version_num );
63
  });
64
 
65
- $(document).on( 'select2-close', 'select.fontawesome', function( object ) {
66
  update_preview( this, $(this).val(), version_num );
67
  });
68
 
1
  (function($){
2
 
3
+ var version_num = ACFFA.version;
4
 
5
  $(document).on( 'change', '.field_type-select select, .field_type select, .acf-field-select select', function() {
6
 
7
  if ( $(this).val() == 'font-awesome' ) {
8
 
9
+ var font_awesome_form;
 
10
 
11
+ if ( 5 == version_num ) {
12
+ // ACF 5
13
+ font_awesome_form = $(this).closest( '.acf-field-object-font-awesome' );
14
+ } else {
15
+ // ACF 4
16
  font_awesome_form = $(this).closest( '.field_form' );
 
17
  }
18
 
19
  setTimeout(function() {
38
 
39
  });
40
 
41
+ if ( 5 == version_num ) {
42
+ acf.add_filter('select2_args', function( args, $select, settings, $field ){
43
+
44
+ if ( $field.data('setting') == 'font-awesome' ) {
45
+ args.dropdownCssClass = 'fa-select2-drop';
46
+ }
47
+
48
+ // return
49
+ return args;
50
+
51
+ });
52
+ }
53
 
54
+ $(document).ready(function($) {
55
+
56
  elements = $( 'select.fontawesome' );
57
 
58
+ if ( 4 == version_num ) {
59
+ $( elements ).select2({
60
+ width : '100%',
61
+ dropdownCssClass : 'fa-select2-drop'
62
+ });
63
+ }
64
+
65
  $.each( elements , function( index, el ) {
66
  update_preview( el, $(el).val(), version_num );
67
  });
68
+
69
  });
70
 
71
+ $(document).on( 'select2-selecting select2:selecting', 'select.fontawesome', function( object ) {
72
  update_preview( this, object.val, version_num );
73
  });
74
 
75
+ $(document).on( 'select2-highlight select2:highlight', 'select.fontawesome', function( object ) {
76
  update_preview( this, object.val, version_num );
77
  });
78
 
79
+ $(document).on( 'select2-close select2:close', 'select.fontawesome', function( object ) {
80
  update_preview( this, $(this).val(), version_num );
81
  });
82
 
js/edit_input.js CHANGED
@@ -14,15 +14,15 @@
14
  });
15
  }
16
 
17
- $( 'select.fa-select2-field' ).on( 'select2-selecting', function( object ) {
18
  update_preview( this, object.val );
19
  });
20
 
21
- $( 'select.fa-select2-field' ).on( 'select2-highlight', function( object ) {
22
  update_preview( this, object.val );
23
  });
24
 
25
- $( 'select.fa-select2-field' ).on( 'select2-close', function( object ) {
26
  update_preview( this, $(this).val() );
27
  });
28
 
14
  });
15
  }
16
 
17
+ $( 'select.fa-select2-field' ).on( 'select2-selecting select2:selecting', function( object ) {
18
  update_preview( this, object.val );
19
  });
20
 
21
+ $( 'select.fa-select2-field' ).on( 'select2-highlight select2:highlight', function( object ) {
22
  update_preview( this, object.val );
23
  });
24
 
25
+ $( 'select.fa-select2-field' ).on( 'select2-close select2:close', function( object ) {
26
  update_preview( this, $(this).val() );
27
  });
28
 
js/select2/select2_locale_zh-TW.js CHANGED
File without changes
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mattkeys
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UTNU7YJG2KVPJ
4
  Tags: Advanced Custom Fields, ACF, Font Awesome, FontAwesome
5
  Requires at least: 3.5
6
- Tested up to: 4.6
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -40,6 +40,9 @@ This ACF field type is compatible with:
40
 
41
  == Changelog ==
42
 
 
 
 
43
  = 1.7.3 =
44
  * Updated Better Font Awesome library to latest version
45
  * Updated 'fallback' ACF font to 4.6.3
@@ -105,6 +108,9 @@ This ACF field type is compatible with:
105
 
106
  == Upgrade Notice ==
107
 
 
 
 
108
  = 1.7.3 =
109
  Updated Better Font Awesome library to latest version
110
  Updated 'fallback' ACF font to 4.6.3
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UTNU7YJG2KVPJ
4
  Tags: Advanced Custom Fields, ACF, Font Awesome, FontAwesome
5
  Requires at least: 3.5
6
+ Tested up to: 4.8
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
40
 
41
  == Changelog ==
42
 
43
+ = 1.7.4 =
44
+ * Fixed incompatibilities with latest ACF 5 + Select2 v4.x
45
+
46
  = 1.7.3 =
47
  * Updated Better Font Awesome library to latest version
48
  * Updated 'fallback' ACF font to 4.6.3
108
 
109
  == Upgrade Notice ==
110
 
111
+ = 1.7.4 =
112
+ * Fixed incompatibilities with latest ACF 5 + Select2 v4.x
113
+
114
  = 1.7.3 =
115
  Updated Better Font Awesome library to latest version
116
  Updated 'fallback' ACF font to 4.6.3