Add hooks for additional performance calculations

This commit is contained in:
Brian Miyaji
2019-05-31 15:55:03 +10:00
parent dd81afec31
commit 2b1583f0bd
4 changed files with 9 additions and 9 deletions

View File

@@ -420,8 +420,8 @@ class SP_Player_List extends SP_Secondary_Post {
endif;
endforeach;
elseif ( array_key_exists( $key, $totals[ $player_id ] ) ):
$value = floatval( $value );
$totals[ $player_id ][ $key ] += $value;
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
$totals[ $player_id ][ $key ] += $add;
endif;
endforeach;
@@ -601,7 +601,7 @@ class SP_Player_List extends SP_Secondary_Post {
$placeholder = number_format( $placeholder, $stat->precision, '.', '' );
endif;
$placeholders[ $player_id ][ $stat->post_name ] = $placeholder;
$placeholders[ $player_id ][ $stat->post_name ] = apply_filters( 'sportspress_player_performance_table_placeholder', $placeholder, $stat->post_name );
endforeach;
endforeach;

View File

@@ -369,8 +369,8 @@ class SP_Player extends SP_Custom_Post {
foreach ( $player_performance as $key => $value ):
if ( array_key_exists( $key, $totals ) ):
$value = floatval( $value );
$totals[ $key ] += $value;
$add = apply_filters( 'sportspress_player_performance_add_value', floatval( $value ), $key );
$totals[ $key ] += $add;
endif;
endforeach;
@@ -552,7 +552,7 @@ class SP_Player extends SP_Custom_Post {
endforeach;
foreach ( $performance_labels as $key => $label ):
$placeholders[ $div_id ][ $key ] = sp_array_value( $totals, $key, 0 );
$placeholders[ $div_id ][ $key ] = apply_filters( 'sportspress_player_performance_table_placeholder', sp_array_value( $totals, $key, 0 ), $key );
endforeach;
endforeach;

View File

@@ -169,7 +169,7 @@ $i = 0;
endif;
if ( 'number' === $format ):
$add = floatval( $value );
$add = apply_filters( 'sportspress_event_performance_add_value', floatval( $value ), $key );
$totals[ $key ] += $add;
endif;
endif;

View File

@@ -96,7 +96,7 @@ if ( is_array( $teams ) ):
$formats[ $column->post_name ] = $format;
}
do_action( 'sportspress_before_event_performance' );
do_action( 'sportspress_before_event_performance', $columns );
if ( $is_individual ) {
// Combined table