Merge pull request #290 from ThemeBoy/feature-statistics-icons

Feature statistics icons
This commit is contained in:
Brian Miyaji
2018-08-28 23:35:23 +10:00
committed by GitHub
10 changed files with 159 additions and 28 deletions

View File

@@ -213,8 +213,17 @@ class SP_Player_List extends SP_Secondary_Post {
// Add precision to object
$stat->precision = sp_array_value( sp_array_value( $meta, 'sp_precision', array() ), 0, 0 ) + 0;
// Add column name to columns
$columns[ $stat->post_name ] = $stat->post_title;
// Add column icons to columns were is available
if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' && ( $stat->post_type == 'sp_performance' || $stat->post_type == 'sp_statistic' ) ) {
$icon = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 );
if ( $icon != '' ) {
$columns[ $stat->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 );
}else{
$columns[ $stat->post_name ] = $stat->post_title;
}
}else{
$columns[ $stat->post_name ] = $stat->post_title;
}
// Add format
$format = get_post_meta( $stat->ID, 'sp_format', true );
@@ -716,8 +725,12 @@ class SP_Player_List extends SP_Secondary_Post {
$labels = array();
if ( in_array( 'number', $this->columns ) ) $labels['number'] = '#';
$labels['name'] = __( 'Player', 'sportspress' );
if ( in_array( 'team', $this->columns ) ) $labels['team'] = __( 'Team', 'sportspress' );
if ( in_array( 'position', $this->columns ) ) $labels['position'] = __( 'Position', 'sportspress' );
if ( in_array( 'team', $this->columns ) ) {
$labels['team'] = __( 'Team', 'sportspress' );
}
if ( in_array( 'position', $this->columns ) ) {
$labels['position'] = __( 'Position', 'sportspress' );
}
$merged[0] = array_merge( $labels, $columns );
return $merged;