Version Description
- Fixed bug with FA fields assigned to menu items + further refactoring of JS for ACF v5
Download this release
Release Info
Developer | mattkeys |
Plugin | Advanced Custom Fields: Font Awesome Field |
Version | 2.0.7 |
Comparing to | |
See all releases |
Code changes from version 2.0.6 to 2.0.7
- acf-font-awesome.php +2 -2
- assets/js/input-v5.js +20 -5
- readme.txt +6 -0
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.
|
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.
|
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.7
|
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.7',
|
28 |
'url' => plugin_dir_url( __FILE__ ),
|
29 |
'path' => plugin_dir_path( __FILE__ )
|
30 |
);
|
assets/js/input-v5.js
CHANGED
@@ -18,13 +18,17 @@
|
|
18 |
var $select = $( fa_field );
|
19 |
var parent = $( $select ).closest('.acf-field-font-awesome');
|
20 |
|
21 |
-
$select.addClass('select2_initalized');
|
22 |
-
|
23 |
update_preview( $select.val(), parent );
|
24 |
|
25 |
acf.select2.init( $select, select2_init_args( fa_field ), $( fa_field ) );
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
// Add our classes to FontAwesome select2 fields
|
29 |
acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
|
30 |
|
@@ -37,7 +41,7 @@
|
|
37 |
});
|
38 |
|
39 |
// Update FontAwesome field previews in field create area
|
40 |
-
acf.add_action( '
|
41 |
var $field_objects = $('.acf-field-object[data-type="font-awesome"]');
|
42 |
|
43 |
$field_objects.each( function( index, field_object ) {
|
@@ -45,9 +49,20 @@
|
|
45 |
});
|
46 |
});
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
// Update FontAwesome field previews and init select2 in field edit area
|
49 |
-
acf.add_action( '
|
50 |
-
var $fa_fields = $( 'select.fontawesome-edit:
|
51 |
|
52 |
if ( $fa_fields.length ) {
|
53 |
$fa_fields.each( function( index, fa_field ) {
|
18 |
var $select = $( fa_field );
|
19 |
var parent = $( $select ).closest('.acf-field-font-awesome');
|
20 |
|
|
|
|
|
21 |
update_preview( $select.val(), parent );
|
22 |
|
23 |
acf.select2.init( $select, select2_init_args( fa_field ), $( fa_field ) );
|
24 |
}
|
25 |
|
26 |
+
acf.add_action( 'select2_init', function( $input, args, settings, $field ) {
|
27 |
+
if ( $field instanceof jQuery && $field.hasClass('fontawesome-edit') ) {
|
28 |
+
$field.addClass('select2_initalized');
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
// Add our classes to FontAwesome select2 fields
|
33 |
acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
|
34 |
|
41 |
});
|
42 |
|
43 |
// Update FontAwesome field previews in field create area
|
44 |
+
acf.add_action( 'open_field/type=font-awesome', function( $el ) {
|
45 |
var $field_objects = $('.acf-field-object[data-type="font-awesome"]');
|
46 |
|
47 |
$field_objects.each( function( index, field_object ) {
|
49 |
});
|
50 |
});
|
51 |
|
52 |
+
// Handle new menu items with FontAwesome fields assigned to them
|
53 |
+
$( document ).on( 'menu-item-added', function( event, $menuMarkup ) {
|
54 |
+
var $fa_fields = $( 'select.fontawesome-edit:not(.select2_initalized)', $menuMarkup );
|
55 |
+
|
56 |
+
if ( $fa_fields.length ) {
|
57 |
+
$fa_fields.each( function( index, fa_field ) {
|
58 |
+
select2_init( fa_field );
|
59 |
+
});
|
60 |
+
}
|
61 |
+
});
|
62 |
+
|
63 |
// Update FontAwesome field previews and init select2 in field edit area
|
64 |
+
acf.add_action( 'ready_field/type=font-awesome append_field/type=font-awesome show_field/type=font-awesome', function( $el ) {
|
65 |
+
var $fa_fields = $( 'select.fontawesome-edit:not(.select2_initalized)', $el );
|
66 |
|
67 |
if ( $fa_fields.length ) {
|
68 |
$fa_fields.each( function( index, fa_field ) {
|
readme.txt
CHANGED
@@ -51,6 +51,9 @@ This ACF field type is compatible with:
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
54 |
= 2.0.6 =
|
55 |
* Refactored JS to simplify codebase and fix bugs where Chosen or Select2 fields would not initialize in a variety of field/sub-field configurations and display options.
|
56 |
|
@@ -142,6 +145,9 @@ This ACF field type is compatible with:
|
|
142 |
|
143 |
== Upgrade Notice ==
|
144 |
|
|
|
|
|
|
|
145 |
= 2.0.6 =
|
146 |
* Refactored JS to simplify codebase and fix bugs where Chosen or Select2 fields would not initialize in a variety of field/sub-field configurations and display options.
|
147 |
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
+
= 2.0.7 =
|
55 |
+
* Fixed bug with FA fields assigned to menu items + further refactoring of JS for ACF v5
|
56 |
+
|
57 |
= 2.0.6 =
|
58 |
* Refactored JS to simplify codebase and fix bugs where Chosen or Select2 fields would not initialize in a variety of field/sub-field configurations and display options.
|
59 |
|
145 |
|
146 |
== Upgrade Notice ==
|
147 |
|
148 |
+
= 2.0.7 =
|
149 |
+
* Fixed bug with FA fields assigned to menu items + further refactoring of JS for ACF v5
|
150 |
+
|
151 |
= 2.0.6 =
|
152 |
* Refactored JS to simplify codebase and fix bugs where Chosen or Select2 fields would not initialize in a variety of field/sub-field configurations and display options.
|
153 |
|