Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/17/2023 11:14:06 AM (13 months ago)
Author:
imath
Message:

Deprecate BP Legacy widgets

Deprecate all classes, functions, JavaScripts and files related to Legacy Widgets. Legacy Widgets are now available from the BP Classic plugin.

See #8869
Closes https://github.com/buddypress/buddypress/pull/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-filters.php

    r13471 r13481  
    11221122
    11231123/**
    1124  * Injects specific BuddyPress CSS classes into a widget sidebar.
    1125  *
    1126  * Helps to standardize styling of BuddyPress widgets within a theme that
    1127  * does not use dynamic CSS classes in their widget sidebar's 'before_widget'
    1128  * call.
    1129  *
    1130  * @since 2.4.0
    1131  * @access private
    1132  *
    1133  * @global array $wp_registered_widgets Current registered widgets.
    1134  *
    1135  * @param array $params Current sidebar params.
    1136  * @return array
    1137  */
    1138 function _bp_core_inject_bp_widget_css_class( $params ) {
    1139     global $wp_registered_widgets;
    1140 
    1141     $widget_id = $params[0]['widget_id'];
    1142 
    1143     // If callback isn't an array, bail.
    1144     if ( false === is_array( $wp_registered_widgets[ $widget_id ]['callback'] ) ) {
    1145         return $params;
    1146     }
    1147 
    1148     // If the current widget isn't a BuddyPress one, stop!
    1149     // We determine if a widget is a BuddyPress widget, if the widget class
    1150     // begins with 'bp_'.
    1151     if ( 0 !== strpos( $wp_registered_widgets[ $widget_id ]['callback'][0]->id_base, 'bp_' ) ) {
    1152         return $params;
    1153     }
    1154 
    1155     // Dynamically add our widget CSS classes for BP widgets if not already there.
    1156     $classes = array();
    1157 
    1158     // Try to find 'widget' CSS class.
    1159     if ( false === strpos( $params[0]['before_widget'], 'widget ' ) ) {
    1160         $classes[] = 'widget';
    1161     }
    1162 
    1163     // Try to find 'buddypress' CSS class.
    1164     if ( false === strpos( $params[0]['before_widget'], ' buddypress' ) ) {
    1165         $classes[] = 'buddypress';
    1166     }
    1167 
    1168     // Stop if widget already has our CSS classes.
    1169     if ( empty( $classes ) ) {
    1170         return $params;
    1171     }
    1172 
    1173     // CSS injection time!
    1174     $params[0]['before_widget'] = str_replace( 'class="', 'class="' . implode( ' ', $classes ) . ' ', $params[0]['before_widget'] );
    1175 
    1176     return $params;
    1177 }
    1178 add_filter( 'dynamic_sidebar_params', '_bp_core_inject_bp_widget_css_class' );
    1179 
    1180 /**
    11811124 * Add email link styles to rendered email template.
    11821125 *
Note: See TracChangeset for help on using the changeset viewer.