get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
);
extract( $defaults, EXTR_SKIP );
$countries = SP()->countries->countries;
$player = new SP_Player( $id );
$nationality = $player->nationality;
$current_teams = $player->current_teams();
$past_teams = $player->past_teams();
$metrics_before = $player->metrics( true );
$metrics_after = $player->metrics( false );
$common = array();
if ( $nationality ):
$country_name = sp_array_value( $countries, $nationality, null );
$common[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $show_nationality_flags ? '
' : '' ) . $country_name : '—';
endif;
$position_names = array();
$positions = get_the_terms( $id, 'sp_position' );
if ( $positions ): foreach ( $positions as $position ):
$position_names[] = $position->name;
endforeach; endif;
$common[ __( 'Position', 'sportspress' ) ] = implode( ', ', $position_names );
$data = array_merge( $metrics_before, $common, $metrics_after );
if ( $current_teams ):
$teams = array();
foreach ( $current_teams as $team ):
$teams[] = '' . get_the_title( $team ) . '';
endforeach;
$label = _n( 'Current Team', 'Current Teams', count( $teams ) );
$data[ $label ] = implode( ', ', $teams );
endif;
if ( $past_teams ):
$teams = array();
foreach ( $past_teams as $team ):
$teams[] = '' . get_the_title( $team ) . '';
endforeach;
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
endif;
$output = '