Add a global option to enable player_assignments

This commit is contained in:
savvasha
2018-03-27 22:07:00 +03:00
parent 75c20300b8
commit c9afa326e2

View File

@@ -23,10 +23,12 @@ class SportsPress_Player_Assignments {
public function __construct() { public function __construct() {
// Define constants // Define constants
$this->define_constants(); $this->define_constants();
// Actions // Actions
add_action( 'sportspress_save_meta_player_statistics', array( $this, 'save_additional_statistics' ), 10, 2 ); add_action( 'sportspress_save_meta_player_statistics', array( $this, 'save_additional_statistics' ), 10, 2 );
// Filters // Filters
add_filter( 'sportspress_player_list_options', array( $this, 'add_settings' ) );
} }
/** /**
* Define constants. * 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; endif;
if ( get_option( 'sportspress_load_player_assignments_module', 'yes' ) == 'yes' ) { //Is it needed? if ( get_option( 'sportspress_load_player_assignments_module', 'yes' ) == 'yes' ) { //Is it needed?