Advanced Custom Fields: Font Awesome Field - Version 2.0.5

Version Description

  • Fixed bug with ACF tabs + FontAwesome fields where Chosen/Select2 would not initialize beyond the first tab shown
Download this release

Release Info

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

Code changes from version 2.0.4 to 2.0.5

acf-font-awesome.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Advanced Custom Fields: Font Awesome
5
  Plugin URI: https://wordpress.org/plugins/advanced-custom-fields-font-awesome/
6
  Description: Adds a new 'Font Awesome Icon' field to the popular Advanced Custom Fields plugin.
7
- Version: 2.0.4
8
  Author: mattkeys
9
  Author URI: http://mattkeys.me/
10
  License: GPLv2 or later
@@ -24,7 +24,7 @@ if ( ! class_exists('acf_plugin_font_awesome') ) :
24
  public function __construct()
25
  {
26
  $this->settings = array(
27
- 'version' => '2.0.0',
28
  'url' => plugin_dir_url( __FILE__ ),
29
  'path' => plugin_dir_path( __FILE__ )
30
  );
4
  Plugin Name: Advanced Custom Fields: Font Awesome
5
  Plugin URI: https://wordpress.org/plugins/advanced-custom-fields-font-awesome/
6
  Description: Adds a new 'Font Awesome Icon' field to the popular Advanced Custom Fields plugin.
7
+ Version: 2.0.5
8
  Author: mattkeys
9
  Author URI: http://mattkeys.me/
10
  License: GPLv2 or later
24
  public function __construct()
25
  {
26
  $this->settings = array(
27
+ 'version' => '2.0.5',
28
  'url' => plugin_dir_url( __FILE__ ),
29
  'path' => plugin_dir_path( __FILE__ )
30
  );
assets/js/input-v4.js CHANGED
@@ -50,8 +50,32 @@
50
  }
51
  });
52
 
53
- $( document ).on( 'acf/field_form-open', function( event, field ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
 
55
  var $select = $( '.chosen-fontawesome:not(.chosen_initialized)', field );
56
 
57
  if ( $select.length ) {
50
  }
51
  });
52
 
53
+ $( document ).on( 'click', '.acf-tab-button', function( e ) {
54
+ e.preventDefault();
55
+
56
+ var $wrap = $( this ).closest('.acf-tab-wrap').parent();
57
+ var key = $( this ).attr('data-key');
58
+
59
+ $wrap.children('.field_type-tab').each( function() {
60
+ var $tab = $( this );
61
+
62
+ if ( key == $tab.attr('data-field_key') ) {
63
+ $( this ).nextUntil('.field_type-tab').each( function() {
64
+ var $select = $( '.chosen-fontawesome:not(.chosen_initialized)', this );
65
+
66
+ if ( $select.length ) {
67
+ update_preview( $select.val(), this );
68
+
69
+ if ( ACFFA.chosen ) {
70
+ initialize_chosen( $select, true );
71
+ }
72
+ }
73
+ });
74
+ }
75
+ });
76
+ });
77
 
78
+ $( document ).on( 'acf/field_form-open', function( event, field ) {
79
  var $select = $( '.chosen-fontawesome:not(.chosen_initialized)', field );
80
 
81
  if ( $select.length ) {
assets/js/input-v5.js CHANGED
@@ -46,6 +46,18 @@
46
  }
47
  });
48
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
50
 
51
  if ( $select.hasClass('select2-fontawesome') ) {
46
  }
47
  });
48
 
49
+ acf.add_action( 'show_field', function( $el, context ) {
50
+ if ( 'tab' == context ) {
51
+ var $fa_fields = $el;
52
+
53
+ $fa_fields.each( function( index, fa_field ) {
54
+ update_preview( $( 'select.fontawesome-edit', fa_field ).val(), fa_field );
55
+
56
+ acf.select2.init( $( 'select.fontawesome-edit', fa_field ), select2_init_args( fa_field ), $( fa_field ) );
57
+ });
58
+ }
59
+ });
60
+
61
  acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
62
 
63
  if ( $select.hasClass('select2-fontawesome') ) {
readme.txt CHANGED
@@ -51,6 +51,9 @@ This ACF field type is compatible with:
51
 
52
  == Changelog ==
53
 
 
 
 
54
  = 2.0.4 =
55
  * Added filter (ACFFA_always_enqueue_fa) to allow FontAwesome to always be enqueued on your sites frontend, even if no ACF FontAwesome fields are in use on the page.
56
 
@@ -136,6 +139,9 @@ This ACF field type is compatible with:
136
 
137
  == Upgrade Notice ==
138
 
 
 
 
139
  = 2.0.4 =
140
  * Added filter (ACFFA_always_enqueue_fa) to allow FontAwesome to always be enqueued on your sites frontend, even if no ACF FontAwesome fields are in use on the page.
141
 
51
 
52
  == Changelog ==
53
 
54
+ = 2.0.5 =
55
+ * Fixed bug with ACF tabs + FontAwesome fields where Chosen/Select2 would not initialize beyond the first tab shown
56
+
57
  = 2.0.4 =
58
  * Added filter (ACFFA_always_enqueue_fa) to allow FontAwesome to always be enqueued on your sites frontend, even if no ACF FontAwesome fields are in use on the page.
59
 
139
 
140
  == Upgrade Notice ==
141
 
142
+ = 2.0.5 =
143
+ * Fixed bug with ACF tabs + FontAwesome fields where Chosen/Select2 would not initialize beyond the first tab shown
144
+
145
  = 2.0.4 =
146
  * Added filter (ACFFA_always_enqueue_fa) to allow FontAwesome to always be enqueued on your sites frontend, even if no ACF FontAwesome fields are in use on the page.
147