id = 'events'; $this->label = __( 'Events', 'sportspress' ); add_filter( 'sportspress_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); add_action( 'sportspress_settings_' . $this->id, array( $this, 'output' ) ); add_action( 'sportspress_admin_field_delimiter', array( $this, 'delimiter_setting' ) ); add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) ); } /** * Get settings array * * @return array */ public function get_settings() { $settings = array( array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ), array( 'title' => __( 'Number of Teams', 'sportspress' ), 'id' => 'sportspress_event_num_teams', 'css' => 'width:50px;', 'default' => '2', 'type' => 'number', 'custom_attributes' => array( 'min' => 0, 'step' => 1 ) ), array( 'type' => 'delimiter' ), array( 'title' => __( 'Venue', 'sportspress' ), 'desc' => __( 'Display maps', 'sportspress' ), 'id' => 'sportspress_event_show_maps', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', ), array( 'desc' => __( 'Link venues', 'sportspress' ), 'id' => 'sportspress_event_link_venues', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', ), array( 'title' => __( 'Performance', 'sportspress' ), 'desc' => __( 'Link players', 'sportspress' ), 'id' => 'sportspress_event_link_players', 'default' => 'yes', 'type' => 'checkbox', ), array( 'type' => 'sectionend', 'id' => 'event_options' ), array( 'title' => __( 'Text', 'sportspress' ), 'type' => 'title', 'desc' => __( 'The following options affect how words are displayed on the frontend.', 'sportspress' ), 'id' => 'text_options' ), ); foreach ( SP()->text->event as $key => $value ): $settings[] = array( 'title' => $value, 'id' => 'sportspress_event_' . $key . '_text', 'default' => '', 'placeholder' => $value, 'type' => 'text', ); endforeach; $settings[] = array( 'type' => 'sectionend', 'id' => 'text_options' ); return apply_filters( 'sportspress_event_settings', $settings ); // End event settings } /** * Save settings */ public function save() { $settings = $this->get_settings(); SP_Admin_Settings::save_fields( $settings ); if ( isset( $_POST['sportspress_event_teams_delimiter'] ) ) update_option( 'sportspress_event_teams_delimiter', $_POST['sportspress_event_teams_delimiter'] ); } /** * Delimiter settings * * @access public * @return void */ public function delimiter_setting() { $selection = get_option( 'sportspress_event_teams_delimiter', 'vs' ); ?>