Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/18/2021 07:25:13 PM (3 years ago)
Author:
imath
Message:

Inject Group's Invites & Manage Members JS templates into footer

To make sure JS Templates are injected without being altered in WordPress themes supporting the Full Site Editing feature, we are now doing it inside the page's footer.

HTML placeholders for both UI have been moved out of the JS Templates and a backward compatibility for potential plugins still expecting these placeholders into these templates has been put in place.

See #8474

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/groups/template-tags.php

    r13108 r13193  
    44 *
    55 * @since 3.0.0
    6  * @version 9.0.0
     6 * @version 10.0.0
    77 */
    88
     
    158158
    159159/**
     160 * Prints the JS Templates to invite new members to join the Group.
     161 *
     162 * @since 10.0.0
     163 */
     164function bp_nouveau_group_print_invites_templates() {
     165    bp_get_template_part( 'common/js-templates/invites/index' );
     166}
     167
     168/**
     169 * Prints the HTML placeholders to invite new members to join the Group.
     170 *
     171 * @since 10.0.0
     172 */
     173function bp_nouveau_group_print_invites_placeholders() {
     174    if ( bp_is_group_create() ) : ?>
     175
     176        <h3 class="bp-screen-title creation-step-name">
     177            <?php esc_html_e( 'Invite Members', 'buddypress' ); ?>
     178        </h3>
     179
     180    <?php else : ?>
     181
     182        <h2 class="bp-screen-title">
     183            <?php esc_html_e( 'Invite Members', 'buddypress' ); ?>
     184        </h2>
     185
     186    <?php endif; ?>
     187
     188    <div id="group-invites-container">
     189        <nav class="<?php bp_nouveau_single_item_subnav_classes(); ?>" id="subnav" role="navigation" aria-label="<?php esc_attr_e( 'Group invitations menu', 'buddypress' ); ?>"></nav>
     190        <div class="group-invites-column">
     191            <div class="subnav-filters group-subnav-filters bp-invites-filters"></div>
     192            <div class="bp-invites-feedback"></div>
     193            <div class="members bp-invites-content"></div>
     194        </div>
     195    </div>
     196    <?php
     197}
     198
     199/**
    160200 * Load the Group Invites UI.
    161201 *
     
    172212    do_action( 'bp_before_group_send_invites_content' );
    173213
    174     bp_get_template_part( 'common/js-templates/invites/index' );
     214    /**
     215     * Get the templates to manage Group Members using the BP REST API.
     216     *
     217     * @since 10.0.0 Hook to the `wp_footer` action to print the JS templates.
     218     */
     219    add_action( 'wp_footer', 'bp_nouveau_group_print_invites_templates' );
     220    bp_nouveau_group_print_invites_placeholders();
     221
     222    /**
     223     * Private hook to preserve backward compatibility with plugins needing the above placeholders to be located
     224     * into: `bp-templates/bp-nouveau/buddypress/common/js-templates/invites/index.php`.
     225     *
     226     * @since 10.0.0
     227     */
     228    do_action( '_bp_nouveau_group_print_invites_placeholders' );
    175229
    176230    /**
Note: See TracChangeset for help on using the changeset viewer.