Version Description
- Added ability to select no icon by default
- Better handling of 'null' or 'no selection' items
- Fixed bug where default icon would not display in admin area if 'unicode' return type was selected
Download this release
Release Info
Developer | mattkeys |
Plugin | Advanced Custom Fields: Font Awesome Field |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.7
- acf-font-awesome-v4.php +15 -0
- acf-font-awesome-v5.php +16 -0
- acf-font-awesome.php +1 -1
- readme.txt +9 -4
acf-font-awesome-v4.php
CHANGED
@@ -68,6 +68,8 @@ class acf_field_font_awesome extends acf_field
|
|
68 |
$new_icons[ $bfa_prefix . $class ] = $unicode . ' ' . $bfa_prefix . $class;
|
69 |
}
|
70 |
|
|
|
|
|
71 |
return $new_icons;
|
72 |
}
|
73 |
|
@@ -248,6 +250,8 @@ class acf_field_font_awesome extends acf_field
|
|
248 |
// loop through values and add them as options
|
249 |
if( is_array($field['choices']) )
|
250 |
{
|
|
|
|
|
251 |
foreach( $field['choices'] as $key => $value )
|
252 |
{
|
253 |
$selected = $this->find_selected( $key, $field['value'], $field['save_format'], $field['choices'] );
|
@@ -269,6 +273,13 @@ class acf_field_font_awesome extends acf_field
|
|
269 |
$string = str_replace( $search, '', $haystack[0] );
|
270 |
break;
|
271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
case 'class':
|
273 |
$string = $haystack[0];
|
274 |
break;
|
@@ -358,6 +369,10 @@ class acf_field_font_awesome extends acf_field
|
|
358 |
|
359 |
function load_value($value, $post_id, $field)
|
360 |
{
|
|
|
|
|
|
|
|
|
361 |
switch( $field['save_format'] )
|
362 |
{
|
363 |
case 'object':
|
68 |
$new_icons[ $bfa_prefix . $class ] = $unicode . ' ' . $bfa_prefix . $class;
|
69 |
}
|
70 |
|
71 |
+
$new_icons = array_merge( array( 'null' => '- Select -' ), $new_icons );
|
72 |
+
|
73 |
return $new_icons;
|
74 |
}
|
75 |
|
250 |
// loop through values and add them as options
|
251 |
if( is_array($field['choices']) )
|
252 |
{
|
253 |
+
unset( $field['choices']['null'] );
|
254 |
+
|
255 |
foreach( $field['choices'] as $key => $value )
|
256 |
{
|
257 |
$selected = $this->find_selected( $key, $field['value'], $field['save_format'], $field['choices'] );
|
273 |
$string = str_replace( $search, '', $haystack[0] );
|
274 |
break;
|
275 |
|
276 |
+
case 'unicode':
|
277 |
+
$index = $choices[ $needle ];
|
278 |
+
if ( stristr( $index, $haystack[0] ) ) {
|
279 |
+
return 'selected="selected"';
|
280 |
+
}
|
281 |
+
return '';
|
282 |
+
|
283 |
case 'class':
|
284 |
$string = $haystack[0];
|
285 |
break;
|
369 |
|
370 |
function load_value($value, $post_id, $field)
|
371 |
{
|
372 |
+
if ( 'null' == $value ) {
|
373 |
+
return;
|
374 |
+
}
|
375 |
+
|
376 |
switch( $field['save_format'] )
|
377 |
{
|
378 |
case 'object':
|
acf-font-awesome-v5.php
CHANGED
@@ -71,6 +71,8 @@ class acf_field_font_awesome extends acf_field {
|
|
71 |
$new_icons[ $bfa_prefix . $class ] = $unicode . ' ' . $bfa_prefix . $class;
|
72 |
}
|
73 |
|
|
|
|
|
74 |
return $new_icons;
|
75 |
}
|
76 |
|
@@ -237,6 +239,8 @@ class acf_field_font_awesome extends acf_field {
|
|
237 |
// loop through values and add them as options
|
238 |
if( is_array($field['choices']) )
|
239 |
{
|
|
|
|
|
240 |
foreach( $field['choices'] as $key => $value )
|
241 |
{
|
242 |
$selected = $this->find_selected( $key, $field['value'], $field['save_format'], $field['choices'] );
|
@@ -258,6 +262,13 @@ class acf_field_font_awesome extends acf_field {
|
|
258 |
$string = str_replace( $search, '', $haystack[0] );
|
259 |
break;
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
case 'class':
|
262 |
$string = $haystack[0];
|
263 |
break;
|
@@ -330,6 +341,10 @@ class acf_field_font_awesome extends acf_field {
|
|
330 |
|
331 |
function load_value( $value, $post_id, $field ) {
|
332 |
|
|
|
|
|
|
|
|
|
333 |
switch( $field['save_format'] )
|
334 |
{
|
335 |
case 'object':
|
@@ -365,6 +380,7 @@ class acf_field_font_awesome extends acf_field {
|
|
365 |
*/
|
366 |
|
367 |
function helpers_get_dir( $file ) {
|
|
|
368 |
$dir = trailingslashit( dirname( $file ) );
|
369 |
$count = 0;
|
370 |
|
71 |
$new_icons[ $bfa_prefix . $class ] = $unicode . ' ' . $bfa_prefix . $class;
|
72 |
}
|
73 |
|
74 |
+
$new_icons = array_merge( array( 'null' => '- Select -' ), $new_icons );
|
75 |
+
|
76 |
return $new_icons;
|
77 |
}
|
78 |
|
239 |
// loop through values and add them as options
|
240 |
if( is_array($field['choices']) )
|
241 |
{
|
242 |
+
unset( $field['choices']['null'] );
|
243 |
+
|
244 |
foreach( $field['choices'] as $key => $value )
|
245 |
{
|
246 |
$selected = $this->find_selected( $key, $field['value'], $field['save_format'], $field['choices'] );
|
262 |
$string = str_replace( $search, '', $haystack[0] );
|
263 |
break;
|
264 |
|
265 |
+
case 'unicode':
|
266 |
+
$index = $choices[ $needle ];
|
267 |
+
if ( stristr( $index, $haystack[0] ) ) {
|
268 |
+
return 'selected="selected"';
|
269 |
+
}
|
270 |
+
return '';
|
271 |
+
|
272 |
case 'class':
|
273 |
$string = $haystack[0];
|
274 |
break;
|
341 |
|
342 |
function load_value( $value, $post_id, $field ) {
|
343 |
|
344 |
+
if ( 'null' == $value ) {
|
345 |
+
return;
|
346 |
+
}
|
347 |
+
|
348 |
switch( $field['save_format'] )
|
349 |
{
|
350 |
case 'object':
|
380 |
*/
|
381 |
|
382 |
function helpers_get_dir( $file ) {
|
383 |
+
|
384 |
$dir = trailingslashit( dirname( $file ) );
|
385 |
$count = 0;
|
386 |
|
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.
|
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
|
6 |
Author: Matt Keys
|
7 |
Author URI: http://mattkeys.me/
|
8 |
License: GPLv2 or later
|
readme.txt
CHANGED
@@ -40,6 +40,11 @@ This ACF field type is compatible with:
|
|
40 |
|
41 |
== Changelog ==
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
= 1.6.4 =
|
44 |
* Misc JS performance improvements
|
45 |
* Fixed bug where select2 would not initialize on repeater items added mid-rows (using the plus icon at the end of a repeater row)
|
@@ -86,6 +91,9 @@ This ACF field type is compatible with:
|
|
86 |
|
87 |
== Upgrade Notice ==
|
88 |
|
|
|
|
|
|
|
89 |
= 1.6.4 =
|
90 |
Misc JS performance improvements and fixed bug where select2 would not initialize on repeater items added mid-rows (using the plus icon at the end of a repeater row)
|
91 |
|
@@ -96,7 +104,4 @@ Fixed asset path errors when including this add-on from a theme instead of the p
|
|
96 |
Rolling back changes from 1.6.1 after a number of bugs were reported. Incompatibility issues with Better Font Awesome have been corrected in that plugins code.
|
97 |
|
98 |
= 1.6.1 =
|
99 |
-
Addressing incompatibility issues between this plugin and the Better Font Awesome plugin
|
100 |
-
|
101 |
-
= 1.6 =
|
102 |
-
Misc fixes to JS to properly target ACF fields in the DOM (based on changes to the ACF structure). This should resolve issues with duplicate, or missing select2 fields when picking font awesome icons. Note: this has been tested only on the latest versions of 4.x and 5.x, if you are not on the latest versions I suggest that you ugprade to them before updating this plugin.
|
40 |
|
41 |
== Changelog ==
|
42 |
|
43 |
+
= 1.7 =
|
44 |
+
* Added ability to select no icon by default
|
45 |
+
* Better handling of 'null' or 'no selection' items
|
46 |
+
* Fixed bug where default icon would not display in admin area if 'unicode' return type was selected
|
47 |
+
|
48 |
= 1.6.4 =
|
49 |
* Misc JS performance improvements
|
50 |
* Fixed bug where select2 would not initialize on repeater items added mid-rows (using the plus icon at the end of a repeater row)
|
91 |
|
92 |
== Upgrade Notice ==
|
93 |
|
94 |
+
= 1.7 =
|
95 |
+
Added ability to select no icon by default and better handling of 'null' or 'no selection' items. Fixed bug where default icon would not display in admin area if 'unicode' return type was selected
|
96 |
+
|
97 |
= 1.6.4 =
|
98 |
Misc JS performance improvements and fixed bug where select2 would not initialize on repeater items added mid-rows (using the plus icon at the end of a repeater row)
|
99 |
|
104 |
Rolling back changes from 1.6.1 after a number of bugs were reported. Incompatibility issues with Better Font Awesome have been corrected in that plugins code.
|
105 |
|
106 |
= 1.6.1 =
|
107 |
+
Addressing incompatibility issues between this plugin and the Better Font Awesome plugin
|
|
|
|
|
|