Update modules and hooks
This commit is contained in:
@@ -81,6 +81,7 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
* Save meta box data
|
* Save meta box data
|
||||||
*/
|
*/
|
||||||
public static function save( $post_id, $post ) {
|
public static function save( $post_id, $post ) {
|
||||||
|
do_action( 'sportspress_save_meta_player_statistics', $post_id, $_POST );
|
||||||
update_post_meta( $post_id, 'sp_leagues', sp_array_value( $_POST, 'sp_leagues', array() ) );
|
update_post_meta( $post_id, 'sp_leagues', sp_array_value( $_POST, 'sp_leagues', array() ) );
|
||||||
update_post_meta( $post_id, 'sp_statistics', sp_array_value( $_POST, 'sp_statistics', array() ) );
|
update_post_meta( $post_id, 'sp_statistics', sp_array_value( $_POST, 'sp_statistics', array() ) );
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,7 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false, $formats = array(), $total_types = array() ) {
|
public static function table( $id = null, $league_id, $columns = array(), $data = array(), $placeholders = array(), $merged = array(), $leagues = array(), $has_checkboxes = false, $team_select = false, $formats = array(), $total_types = array() ) {
|
||||||
$readonly = false;
|
$readonly = false;
|
||||||
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
|
$teams = array_filter( get_post_meta( $id, 'sp_team', false ) );
|
||||||
|
$buffer = apply_filters( 'sportspress_meta_box_player_statistics_table_buffer', array( 'teams' => $teams, 'readonly' => $readonly ), $id );
|
||||||
?>
|
?>
|
||||||
<div class="sp-data-table-container">
|
<div class="sp-data-table-container">
|
||||||
<table class="widefat sp-data-table">
|
<table class="widefat sp-data-table">
|
||||||
@@ -105,6 +107,9 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
<?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
|
<?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
|
||||||
<th><?php echo $label; ?></th>
|
<th><?php echo $label; ?></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php if ( $league_id > 0 ) { ?>
|
||||||
|
<th>+−</th>
|
||||||
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
@@ -201,6 +206,10 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
</td>
|
</td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
$collection = array( 'columns' => $columns, 'data' => $data, 'placeholders' => $placeholders, 'merged' => $merged, 'seasons_teams' => array(), 'has_checkboxes' => $has_checkboxes, 'formats' => $formats, 'total_types' => $total_types, 'buffer' => $buffer );
|
||||||
|
list( $columns, $data, $placeholders, $merged, $seasons_teams, $has_checkboxes, $formats, $total_types, $buffer ) = array_values( apply_filters( 'sportspress_meta_box_player_statistics_collection', $collection, $id, $league_id, $div_id, $value ) );
|
||||||
|
?>
|
||||||
<?php foreach ( $columns as $column => $label ): if ( $column == 'team' ) continue;
|
<?php foreach ( $columns as $column => $label ): if ( $column == 'team' ) continue;
|
||||||
?>
|
?>
|
||||||
<td><?php
|
<td><?php
|
||||||
@@ -225,10 +234,13 @@ class SP_Meta_Box_Player_Statistics {
|
|||||||
}
|
}
|
||||||
?></td>
|
?></td>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php do_action( 'sportspress_meta_box_player_statistics_table_row', $id, $league_id, $div_id, $team_select, $buffer, $i ); ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$i++;
|
$i++;
|
||||||
|
do_action( 'sportspress_meta_box_player_statistics_table_after_row', $id, $league_id, $div_id, $team_select, $buffer, $i );
|
||||||
endforeach;
|
endforeach;
|
||||||
|
do_action( 'sportspress_meta_box_player_statistics_table_tbody', $id, $league_id, $div_id, $team_select, $buffer );
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -106,6 +106,14 @@ class SP_Modules {
|
|||||||
'icon' => 'sp-icon-list',
|
'icon' => 'sp-icon-list',
|
||||||
'desc' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ),
|
'desc' => __( 'Create team rosters, player galleries, and ranking charts.', 'sportspress' ),
|
||||||
),
|
),
|
||||||
|
'midseason_transfers' => array(
|
||||||
|
'label' => __( 'Midseason Transfers', 'sportspress' ),
|
||||||
|
'class' => 'SportsPress_Midseason_Transfers',
|
||||||
|
'icon' => 'sp-icon-sub',
|
||||||
|
'link' => 'https://www.themeboy.com/sportspress-extensions/midseason-transfers/',
|
||||||
|
'desc' => __( 'Statistics for players who transferred between teams during a season.', 'sportspress' ),
|
||||||
|
'default' => 'yes',
|
||||||
|
),
|
||||||
'staff_directories' => array(
|
'staff_directories' => array(
|
||||||
'label' => __( 'Directories', 'sportspress' ),
|
'label' => __( 'Directories', 'sportspress' ),
|
||||||
'class' => 'SportsPress_Staff_Directories',
|
'class' => 'SportsPress_Staff_Directories',
|
||||||
|
|||||||
@@ -69,11 +69,17 @@ if ( is_array( $leagues ) ):
|
|||||||
'data' => $player->data( $league->term_id, false, $section_id ),
|
'data' => $player->data( $league->term_id, false, $section_id ),
|
||||||
'caption' => $caption,
|
'caption' => $caption,
|
||||||
'scrollable' => $scrollable,
|
'scrollable' => $scrollable,
|
||||||
|
'league_id' => $league->term_id,
|
||||||
);
|
);
|
||||||
if ( ! $show_teams ) {
|
if ( ! $show_teams ) {
|
||||||
$args['hide_teams'] = true;
|
$args['hide_teams'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( has_action( 'sportspress_player_statistics_league_template' ) ) {
|
||||||
|
do_action( 'sportspress_player_statistics_league_template', $args );
|
||||||
|
} else {
|
||||||
sp_get_template( 'player-statistics-league.php', $args );
|
sp_get_template( 'player-statistics-league.php', $args );
|
||||||
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
if ( $show_career_totals ) {
|
if ( $show_career_totals ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user