Block binding: Add value for displaying short contribution details

This commit is contained in:
Kelly Dwan 2024-08-29 16:57:45 -04:00
parent f2e80b8d07
commit 0e5b8788eb
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
2 changed files with 8 additions and 2 deletions

View file

@ -59,5 +59,11 @@ function get_meta_binding_value( $args, $block ) {
number_format_i18n( absint( $contribution_data['hours'] ) ),
count( $contribution_data['teams'] )
);
case 'org-contribution-short-details':
$contribution_data = get_aggregate_contributor_data_for_pledge( $block->context['postId'] );
return sprintf(
__( 'Has pledged %s hours per week.', 'wporg-5ftf' ),
number_format_i18n( absint( $contribution_data['hours'] ) ),
);
}
}