BP_Nouveau::localize_scripts()
Load localizations for topic script.
Description Description
These localizations require information that may not be loaded even by init.
Source Source
File: bp-templates/bp-nouveau/buddypress-functions.php
public function localize_scripts() { $params = array( 'ajaxurl' => bp_core_ajax_url(), 'confirm' => __( 'Are you sure?', 'buddypress' ), 'show_x_comments' => __( 'Show all %d comments', 'buddypress' ), 'unsaved_changes' => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ), 'object_nav_parent' => '#buddypress', ); // If the Object/Item nav are in the sidebar if ( bp_nouveau_is_object_nav_in_sidebar() ) { $params['object_nav_parent'] = '.buddypress_object_nav'; } /** * Filters the supported BuddyPress Nouveau components. * * @since 3.0.0 * * @param array $value Array of supported components. */ $supported_objects = (array) apply_filters( 'bp_nouveau_supported_components', bp_core_get_packaged_component_ids() ); $object_nonces = array(); foreach ( $supported_objects as $key_object => $object ) { if ( ! bp_is_active( $object ) || 'forums' === $object ) { unset( $supported_objects[ $key_object ] ); continue; } $object_nonces[ $object ] = wp_create_nonce( 'bp_nouveau_' . $object ); } // Groups require some additional objects. if ( bp_is_active( 'groups' ) ) { $supported_objects = array_merge( $supported_objects, array( 'group_members', 'group_requests' ) ); } // Add components & nonces $params['objects'] = $supported_objects; $params['nonces'] = $object_nonces; // Used to transport the settings inside the Ajax requests if ( is_customize_preview() ) { $params['customizer_settings'] = bp_nouveau_get_temporary_setting( 'any' ); } /** * Filters core JavaScript strings for internationalization before AJAX usage. * * @since 3.0.0 * * @param array $params Array of key/value pairs for AJAX usage. */ wp_localize_script( 'bp-nouveau', 'BP_Nouveau', apply_filters( 'bp_core_get_js_strings', $params ) ); }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |