Skip to:
Content

BuddyPress.org

Changeset 12183


Ignore:
Timestamp:
07/07/2018 09:44:24 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

See #7881 (branch 3.0)

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

Legend:

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

    r12157 r12183  
    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>
  • branches/3.0/src/bp-templates/bp-nouveau/includes/messages/functions.php

    r12157 r12183  
    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();
  • branches/3.0/src/bp-templates/bp-nouveau/includes/messages/template-tags.php

    r12082 r12183  
    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}
  • branches/3.0/src/bp-templates/bp-nouveau/includes/template-tags.php

    r12157 r12183  
    18461846 */
    18471847function bp_nouveau_search_form() {
    1848     bp_get_template_part( 'common/search/search-form' );
     1848    $search_form_html = bp_buffer_template_part( 'common/search/search-form', null, false );
    18491849
    18501850    $objects = bp_nouveau_get_search_objects();
    18511851    if ( empty( $objects['primary'] ) || empty( $objects['secondary'] ) ) {
     1852        echo $search_form_html;
    18521853        return;
    18531854    }
    18541855
    18551856    if ( 'dir' === $objects['primary'] ) {
     1857        /**
     1858         * Filter here to edit the HTML output of the directory search form.
     1859         *
     1860         * NB: This will take in charge the following BP Core Components filters
     1861         *     - bp_directory_members_search_form
     1862         *     - bp_directory_blogs_search_form
     1863         *     - bp_directory_groups_search_form
     1864         *
     1865         * @since 1.9.0
     1866         *
     1867         * @param string $search_form_html The HTML output for the directory search form.
     1868         */
     1869        echo apply_filters( "bp_directory_{$objects['secondary']}_search_form", $search_form_html );
     1870
    18561871        if ( 'activity' === $objects['secondary'] ) {
    18571872            /**
Note: See TracChangeset for help on using the changeset viewer.