From c9afa326e25adbd48b6ddbb4abcf7f2a8a758849 Mon Sep 17 00:00:00 2001 From: savvasha Date: Tue, 27 Mar 2018 22:07:00 +0300 Subject: [PATCH] Add a global option to enable player_assignments --- modules/sportspress-player-assignments.php | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/sportspress-player-assignments.php b/modules/sportspress-player-assignments.php index 767dad5d..0f705131 100644 --- a/modules/sportspress-player-assignments.php +++ b/modules/sportspress-player-assignments.php @@ -23,10 +23,12 @@ class SportsPress_Player_Assignments { public function __construct() { // Define constants $this->define_constants(); + // Actions add_action( 'sportspress_save_meta_player_statistics', array( $this, 'save_additional_statistics' ), 10, 2 ); // Filters + add_filter( 'sportspress_player_list_options', array( $this, 'add_settings' ) ); } /** * Define constants. @@ -69,6 +71,30 @@ class SportsPress_Player_Assignments { } } } + + /** + * Add settings. + * + * @return array + */ + public function add_settings( $settings ) { + + $settings = array_merge( $settings, + array( + array( + 'title' => __( 'Filter by player assignment', 'sportspress' ), + 'desc' => __( 'Use a stronger conncetion between leagues, seasons and teams', 'sportspress' ), + 'id' => 'sportspress_list_player_assignments', + 'default' => 'yes', + 'type' => 'checkbox', + ), + array( + array( 'type' => 'sectionend', 'id' => 'timelines_options' ), + ) + ) + ); + return $settings; + } } endif; if ( get_option( 'sportspress_load_player_assignments_module', 'yes' ) == 'yes' ) { //Is it needed?