Skip to:
Content

BuddyPress.org

Changeset 12184


Ignore:
Timestamp:
07/07/2018 09:48:52 PM (7 years ago)
Author:
imath
Message:

BP Nouveau: bring back search form filters

Although it was already possible to override search form templates, as the following search form filters are not Legacy filters but Core components ones, we are bringing them back into the Nouveau template pack:

  • bp_directory_members_search_form
  • bp_directory_blogs_search_form
  • bp_directory_groups_search_form
  • bp_message_search_form

Props wbcomdesigns, DJPaul, vapvarun

Fixes #7881 (trunk)

Location:
trunk/src/bp-templates/bp-nouveau
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/common/js-templates/messages/index.php

    r12156 r12184  
    9494    <li class="user-messages-search" role="search" data-bp-search="{{data.box}}">
    9595        <div class="bp-search messages-search">
    96             <form action="" method="get" id="user_messages_search_form" class="bp-messages-search-form" data-bp-search="messages">
    97                 <label for="user_messages_search" class="bp-screen-reader-text">
    98                     <?php _e( 'Search Messages', 'buddypress' ); ?>
    99                 </label>
    100                 <input type="search" id="user_messages_search" placeholder="<?php echo esc_attr_x( 'Search', 'search placeholder text', 'buddypress' ); ?>"/>
    101                 <button type="submit" id="user_messages_search_submit">
    102                     <span class="dashicons dashicons-search" aria-hidden="true"></span>
    103                     <span class="bp-screen-reader-text"><?php echo esc_html_x( 'Search', 'button', 'buddypress' ); ?></span>
    104                 </button>
    105             </form>
     96            <?php bp_nouveau_message_search_form(); ?>
    10697        </div>
    10798    </li>
  • trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php

    r12156 r12184  
    141141 * @since 3.0.0
    142142 */
    143 function bp_nouveau_message_search_form() {
    144     $query_arg   = bp_core_get_component_search_query_arg( 'messages' );
    145     $placeholder = bp_get_search_default_text( 'messages' );
    146 
    147     $search_form_html = '<form action="" method="get" id="search-messages-form">
    148         <label for="messages_search"><input type="text" name="' . esc_attr( $query_arg ) . '" id="messages_search" placeholder="' . esc_attr( $placeholder ) . '" /></label>
    149         <input type="submit" id="messages_search_submit" name="messages_search_submit" value="' . esc_attr_x( 'Search', 'button', 'buddypress' ) . '" />
    150     </form>';
    151 
    152     /**
    153      * Filters the private message component search form.
    154      *
    155      * @since 3.0.0
    156      *
    157      * @param string $search_form_html HTML markup for the message search form.
    158      */
    159     echo apply_filters( 'bp_nouveau_message_search_form', $search_form_html );
    160 }
    161 add_filter( 'bp_message_search_form', 'bp_nouveau_message_search_form', 10, 1 );
    162 
    163 /**
    164  * @since 3.0.0
    165  */
    166143function bp_nouveau_messages_adjust_nav() {
    167144    $bp = buddypress();
  • trunk/src/bp-templates/bp-nouveau/includes/messages/template-tags.php

    r12082 r12184  
    6262    do_action( 'bp_after_member_messages_content' );
    6363}
     64
     65/**
     66 * Output the Member's messages search form.
     67 *
     68 * @since  3.0.0
     69 * @since  3.2.0 Move the function into Template Tags and use a template part.
     70 */
     71function bp_nouveau_message_search_form() {
     72    $search_form_html = bp_buffer_template_part( 'common/js-templates/messages/search-form', null, false );
     73
     74    /**
     75     * Filters the private message component search form.
     76     *
     77     * @since 2.2.0
     78     *
     79     * @param string $search_form_html HTML markup for the message search form.
     80     */
     81    echo apply_filters( 'bp_message_search_form', $search_form_html );
     82}
  • trunk/src/bp-templates/bp-nouveau/includes/template-tags.php

    r12178 r12184  
    18501850 */
    18511851function bp_nouveau_search_form() {
    1852     bp_get_template_part( 'common/search/search-form' );
     1852    $search_form_html = bp_buffer_template_part( 'common/search/search-form', null, false );
    18531853
    18541854    $objects = bp_nouveau_get_search_objects();
    18551855    if ( empty( $objects['primary'] ) || empty( $objects['secondary'] ) ) {
     1856        echo $search_form_html;
    18561857        return;
    18571858    }
    18581859
    18591860    if ( 'dir' === $objects['primary'] ) {
     1861        /**
     1862         * Filter here to edit the HTML output of the directory search form.
     1863         *
     1864         * NB: This will take in charge the following BP Core Components filters
     1865         *     - bp_directory_members_search_form
     1866         *     - bp_directory_blogs_search_form
     1867         *     - bp_directory_groups_search_form
     1868         *
     1869         * @since 1.9.0
     1870         *
     1871         * @param string $search_form_html The HTML output for the directory search form.
     1872         */
     1873        echo apply_filters( "bp_directory_{$objects['secondary']}_search_form", $search_form_html );
     1874
    18601875        if ( 'activity' === $objects['secondary'] ) {
    18611876            /**
Note: See TracChangeset for help on using the changeset viewer.