Add stars feature to box scores

This commit is contained in:
Brian Miyaji
2017-10-31 14:21:29 +11:00
parent 443c1943e4
commit d7e5854639
9 changed files with 72 additions and 70 deletions

View File

@@ -90,6 +90,11 @@ if ( ! isset( $subs ) ) $subs = array();
$name = '<a href="' . $permalink . '">' . $name . '</a>';
endif;
$player_stars = sp_array_value( $stars, $player_id, 0 );
if ( $player_stars ):
$name .= ' <span class="sp-event-stars">' . str_repeat( '<i class="sp-event-star dashicons dashicons-star-filled" title="' . __( 'Player of the Match', 'sportspress' ) . '"></i>', $player_stars ) . '<span>';
endif;
if ( array_key_exists( $player_id, $lineup_sub_relation ) ):
$name .= ' <span class="sub-in" title="' . get_the_title( $lineup_sub_relation[ $player_id ] ) . '">' . sp_array_value( sp_array_value( $data, $lineup_sub_relation[ $player_id ], array() ), 'number', null ) . '</span>';
elseif ( isset( $row['sub'] ) && $row['sub'] ):

View File

@@ -35,6 +35,7 @@ if ( is_array( $teams ) ):
$event = new SP_Event( $id );
$performance = $event->performance();
$stars = $event->stars();
$link_posts = get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false;
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
@@ -121,6 +122,7 @@ if ( is_array( $teams ) ):
'mode' => $mode,
'data' => $data,
'event' => $event,
'stars' => $stars,
'link_posts' => $link_posts,
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
'primary' => 'primary' == $total ? $primary : null,
@@ -230,6 +232,7 @@ if ( is_array( $teams ) ):
'mode' => $mode,
'data' => $data[ $section_id ],
'event' => $event,
'stars' => $stars,
'link_posts' => $link_posts,
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
'primary' => 'primary' == $total ? $primary : null,
@@ -266,6 +269,7 @@ if ( is_array( $teams ) ):
'mode' => $mode,
'data' => $data,
'event' => $event,
'stars' => $stars,
'link_posts' => $link_posts,
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
'primary' => 'primary' == $total ? $primary : null,