Skip to content

Commit 3e41f94

Browse files
committed
Social Profiles now support a class name argument for FA 6
Signed-off-by: Kev Provance <kevin.provance@gmail.com>
1 parent 103c23c commit 3e41f94

7 files changed

+104
-14
lines changed

redux-core/inc/extensions/social_profiles/class-redux-extension-social-profiles.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Redux
66
* @author Kevin Provance <kevin.provance@gmail.com>
77
* @class Redux_Extension_Social_Profiles
8-
* @version 4.3.17
8+
* @version 4.5.8
99
*
1010
* @noinspection PhpIgnoredClassAliasDeclaration
1111
*/
@@ -27,7 +27,7 @@ class Redux_Extension_Social_Profiles extends Redux_Extension_Abstract {
2727
*
2828
* @var string
2929
*/
30-
public static $version = '4.3.17';
30+
public static $version = '4.5.8';
3131

3232
/**
3333
* Extension friendly name.
@@ -235,6 +235,7 @@ public function save_me( array $saved_options = array(), array $changed_values =
235235

236236
$save_data[] = array(
237237
'id' => $data['id'],
238+
'class' => $data['class'] ?? 'fa',
238239
'icon' => $data['icon'],
239240
'enabled' => $data['enabled'],
240241
'url' => $data['url'],

redux-core/inc/extensions/social_profiles/redux-social-profiles-helpers.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,18 @@ function redux_render_icon_from_id( string $opt_name, string $id, bool $output =
7575
foreach ( $settings as $arr ) {
7676
if ( $id === $arr['id'] ) {
7777
if ( $arr['enabled'] ) {
78+
$arr['class'] = $arr['class'] ?? 'fa';
7879

7980
if ( $output ) {
8081
echo '<a class="' . esc_attr( $a_class ) . '" href="' . esc_url( $arr['url'] ) . '">';
81-
Redux_Social_Profiles_Functions::render_icon( $arr['icon'], $arr['color'], $arr['background'], '' );
82+
Redux_Social_Profiles_Functions::render_icon( $arr['class'], $arr['icon'], $arr['color'], $arr['background'], '' );
8283
echo '</a>';
8384

8485
return true;
8586
} else {
8687
$html = '<a class="' . $a_class . '"href="' . $arr['url'] . '">';
8788

88-
$html .= Redux_Social_Profiles_Functions::render_icon( $arr['icon'], $arr['color'], $arr['background'], '', false );
89+
$html .= Redux_Social_Profiles_Functions::render_icon( $arr['class'], $arr['icon'], $arr['color'], $arr['background'], '', false );
8990
$html .= '</a>';
9091

9192
return $html;

redux-core/inc/extensions/social_profiles/social_profiles/class-redux-social-profiles.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,14 @@ class="redux-social-profiles-container ' . esc_attr( $this->field['class'] ) . '
155155

156156
$icon = ( $social_provider_option && array_key_exists( 'icon', $social_provider_option ) && $social_provider_option['icon'] ) ? $social_provider_option['icon'] : $social_provider_default['icon'];
157157
$name = ( $social_provider_option && array_key_exists( 'name', $social_provider_option ) && $social_provider_option['name'] ) ? $social_provider_option['name'] : $social_provider_default['name'];
158+
$class = ( $social_provider_option && array_key_exists( 'class', $social_provider_option ) && $social_provider_option['class'] ) ? $social_provider_option['class'] : $social_provider_default['class'];
158159
$order = ( $social_provider_option && array_key_exists( 'order', $social_provider_option ) ) ? $social_provider_option['order'] : $key;
159160
$order = intval( $order );
160161
$enabled = ( $social_provider_option && array_key_exists( 'enabled', $social_provider_option ) && $social_provider_option['enabled'] ) ? $social_provider_option['enabled'] : $social_provider_default['enabled'];
161162
$display = ( $enabled ) ? 'enabled' : '';
162163

163164
echo '<li class="redux-social-profiles-item-enable ' . esc_attr( $display ) . '" id="redux-social-profiles-item-enable-' . esc_attr( $key ) . '" data-key="' . esc_attr( $key ) . '" data-order="' . esc_attr( $order ) . '">';
164-
Redux_Social_Profiles_Functions::render_icon( $icon, '', '', $name );
165+
Redux_Social_Profiles_Functions::render_icon( $class, $icon, '', '', $name );
165166
echo '</li>';
166167
}
167168

@@ -177,6 +178,7 @@ class="redux-social-profiles-container ' . esc_attr( $this->field['class'] ) . '
177178
$social_provider_option = ( $settings && is_array( $settings ) && array_key_exists( $key, $settings ) ) ? $settings[ $key ] : null;
178179
$icon = ( $social_provider_option && array_key_exists( 'icon', $social_provider_option ) && $social_provider_option['icon'] ) ? $social_provider_option['icon'] : $social_provider_default['icon'];
179180
$id = ( $social_provider_option && array_key_exists( 'id', $social_provider_option ) && $social_provider_option['id'] ) ? $social_provider_option['id'] : $social_provider_default['id'];
181+
$class = ( $social_provider_option && array_key_exists( 'class', $social_provider_option ) && $social_provider_option['class'] ) ? $social_provider_option['class'] : $social_provider_default['class'];
180182
$enabled = ( $social_provider_option && array_key_exists( 'enabled', $social_provider_option ) && $social_provider_option['enabled'] ) ? $social_provider_option['enabled'] : $social_provider_default['enabled'];
181183
$name = ( $social_provider_option && array_key_exists( 'name', $social_provider_option ) && $social_provider_option['name'] ) ? $social_provider_option['name'] : $social_provider_default['name'];
182184

@@ -196,6 +198,7 @@ class="redux-social-profiles-container ' . esc_attr( $this->field['class'] ) . '
196198

197199
$profile_data = array(
198200
'id' => $id,
201+
'class' => $class,
199202
'icon' => $icon,
200203
'enabled' => $enabled,
201204
'url' => $url,
@@ -216,7 +219,7 @@ class="redux-social-profiles-hidden-data-' . esc_attr( $key ) . '"
216219
value="' . $profile_data . '" />'; // phpcs:ignore WordPress.Security.EscapeOutput
217220

218221
echo '<div class="redux-icon-preview">';
219-
Redux_Social_Profiles_Functions::render_icon( $icon, $color, $background, $name );
222+
Redux_Social_Profiles_Functions::render_icon( $class, $icon, $color, $background, $name );
220223
echo '&nbsp;</div>';
221224

222225
echo '<div class="redux-social-profiles-item-name">';

0 commit comments

Comments
 (0)