Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/28/2024 06:43:17 PM (16 months ago)
Author:
imath
Message:

BP Blocks: make sure default block titles can be translated

Some of the BP Blocks are using a title attribute into their block.json. Unfortunately, block attributes do not seem to be include in the translatable strings of the WP Block Metadata API.

To fix this, all block.json title attributes now default to an empty string & the default title value is handled within the PHP callback to render the block.

For the specific case of the Latest Activities block, this commit also fixes some errors that were preventing it to be able to select the list of Activity types to include into the rendered activities.

Fixes #9074 (branch 12.0)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/12.0/src/bp-members/bp-members-blocks.php

    r13710 r13717  
    392392        $attributes,
    393393        array(
    394             'title'         => __( 'Members', 'buddypress' ),
     394            'title'         => '',
    395395            'maxMembers'    => 5,
    396396            'memberDefault' => 'active',
     
    398398        )
    399399    );
     400
     401    if ( ! $block_args['title'] ) {
     402        $block_args['title'] = __( 'Members', 'buddypress' );
     403    }
    400404
    401405    $classnames         = 'widget_bp_core_members_widget buddypress widget';
     
    699703        $attributes,
    700704        array(
    701             'title'      => __( 'Who\'s Online', 'buddypress' ),
     705            'title'      => '',
    702706            'maxMembers' => 15,
    703707            'noMembers'  => __( 'There are no users currently online', 'buddypress' ),
     
    708712
    709713    $block_args['type'] = 'online';
     714
     715    if ( ! $block_args['title'] ) {
     716        $block_args['title'] = __( 'Who\'s Online', 'buddypress' );
     717    }
    710718
    711719    return bp_members_render_members_avatars_block( $block_args );
     
    724732        $attributes,
    725733        array(
    726             'title'      => __( 'Recently Active Members', 'buddypress' ),
     734            'title'      => '',
    727735            'maxMembers' => 15,
    728736            'noMembers'  => __( 'There are no recently active members', 'buddypress' ),
     
    734742    $block_args['type'] = 'active';
    735743
     744    if ( ! $block_args['title'] ) {
     745        $block_args['title'] = __( 'Recently Active Members', 'buddypress' );
     746    }
     747
    736748    return bp_members_render_members_avatars_block( $block_args );
    737749}
Note: See TracChangeset for help on using the changeset viewer.