BP_Nouveau::register_scripts()
Register Template Pack JavaScript files
Description
Source
File: bp-templates/bp-nouveau/buddypress-functions.php
public function register_scripts() { $min = bp_core_get_minified_asset_suffix(); $dependencies = bp_core_get_js_dependencies(); $bp_confirm = array_search( 'bp-confirm', $dependencies ); unset( $dependencies[ $bp_confirm ] ); /** * Filters the scripts to enqueue for BuddyPress Nouveau. * * This filter provides a multidimensional array that will map to arguments used for wp_register_script(). * The primary index should have the script handle to use, and be assigned an array that has indexes for * file location, dependencies, version and if it should load in the footer or not. * * @since BuddyPress 3.0.0 * * @param array $value Array of scripts to register. */ $scripts = apply_filters( 'bp_nouveau_register_scripts', array( 'bp-nouveau' => array( 'file' => 'js/buddypress-nouveau%s.js', 'dependencies' => $dependencies, 'version' => $this->version, 'footer' => true, ), ) ); // Bail if no scripts if ( empty( $scripts ) ) { return; } // Add The password verify if needed. if ( bp_is_active( 'settings' ) || bp_get_signup_allowed() ) { $scripts['bp-nouveau-password-verify'] = array( 'file' => 'js/password-verify%s.js', 'dependencies' => array( 'bp-nouveau', 'password-strength-meter' ), 'footer' => true, ); } $scripts['bp-nouveau-magnific-popup'] = array( 'file' => buddypress()->plugin_url . 'bp-core/js/vendor/magnific-popup%s.js', 'dependencies' => array(), 'footer' => true, ); foreach ( $scripts as $handle => $script ) { if ( ! isset( $script['file'] ) ) { continue; } $file = sprintf( $script['file'], $min ); // Locate the asset if needed. if ( false === strpos( $script['file'], '://' ) ) { $asset = bp_locate_template_asset( $file ); if ( empty( $asset['uri'] ) || false === strpos( $asset['uri'], '://' ) ) { continue; } $file = $asset['uri']; } $data = wp_parse_args( $script, array( 'dependencies' => array(), 'version' => $this->version, 'footer' => false, ) ); wp_register_script( $handle, $file, $data['dependencies'], $data['version'], $data['footer'] ); } wp_localize_script( 'bp-nouveau-messages-at', 'BP_Mentions_Options', bp_at_mention_default_options() ); }
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.