bp_nouveau_wrapper( array $args = array() )
Output HTML content into a wrapper.
Description
Parameters
- $args
-
(Optional) Optional arguments
Default value: array()
Source
File: bp-templates/bp-nouveau/includes/functions.php
function bp_nouveau_wrapper( $args = array() ) {
/**
* Classes need to be determined & set by component to a certain degree
*
* Check the component to find a default container_class to add
*/
$current_component_class = bp_current_component() . '-meta';
$generic_class = 'bp-generic-meta';
$r = wp_parse_args( $args, array(
'container' => 'div',
'container_id' => '',
'container_classes' => array( $generic_class, $current_component_class ),
'output' => '',
) );
$valid_containers = array(
'div' => true,
'ul' => true,
'ol' => true,
'span' => true,
'p' => true,
);
// Actually merge some classes defaults and $args
// @todo This is temp, we need certain classes but maybe improve this approach.
$default_classes = array( 'action' );
$r['container_classes'] = array_merge( $r['container_classes'], $default_classes );
if ( empty( $r['container'] ) || ! isset( $valid_containers[ $r['container'] ] ) || empty( $r['output'] ) ) {
return;
}
$container = $r['container'];
$container_id = '';
$container_classes = '';
$output = trim($r['output']);
if ( ! empty( $r['container_id'] ) ) {
$container_id = ' id="' . esc_attr( $r['container_id'] ) . '"';
}
if ( ! empty( $r['container_classes'] ) && is_array( $r['container_classes'] ) ) {
$container_classes = ' class="' . join( ' ', array_map( 'sanitize_html_class', $r['container_classes'] ) ) . '"';
}
// Print the wrapper and its content.
printf( '<%1$s%2$s%3$s>%4$s</%1$s>', $container, $container_id, $container_classes, $output );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.