Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/25/2016 01:49:30 AM (9 years ago)
Author:
dcavins
Message:

Allow bp_field_css_class() to accept multiple classes.

Allow bp_field_css_class() to accept more than one class
name passed as a space-separated string or array.

Fixes #6679.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-template.php

    r10434 r10460  
    444444 * Output the class attribute for a field.
    445445 *
    446  * @param string|bool $class Extra classes to append to class attribute.
     446 * @since 1.0.0
     447 *
     448 * @param array|string $class Extra classes to append to class attribute.
     449 *                            Pass mutiple class names as an array or
     450 *                            space-delimited string.
     451 *
     452 * @return string
    447453 */
    448454function bp_field_css_class( $class = false ) {
     
    462468
    463469        if ( ! empty( $class ) ) {
    464             $css_classes[] = sanitize_title( esc_attr( $class ) );
     470            if ( ! is_array( $class ) ) {
     471                $class = preg_split( '#\s+#', $class );
     472            }
     473            $css_classes = array_map( 'sanitize_html_class', $class );
    465474        }
    466475
Note: See TracChangeset for help on using the changeset viewer.