id ] = $this->label; return $pages; } /** * Get settings array * * @return array */ public function get_settings() { return array(); } /** * Templates * * @return array */ public function templates() { if ( ! isset( $this->template ) ) return array(); $template = $this->template; return SP()->templates->$template; } /** * Output the settings */ public function output() { $settings = $this->get_settings(); SP_Admin_Settings::output_fields( $settings ); } /** * Save settings */ public function save() { global $current_section; $settings = $this->get_settings(); SP_Admin_Settings::save_fields( $settings ); if ( $current_section ) do_action( 'sportspress_update_options_' . $this->template . '_' . $current_section ); $templates = $this->templates(); if ( ! empty( $templates ) ) update_option( 'sportspress_' . $this->template . '_template_order', sp_array_value( $_POST, 'sportspress_' . $this->template . '_template_order', false, 'key' ) ); if ( isset( $_POST['sportspress_template_visibility'] ) && is_array( $_POST['sportspress_template_visibility'] ) ) { foreach ( $_POST['sportspress_template_visibility'] as $option => $toggled ) { if ( $toggled ) { update_option( $option, 'yes' ); } else { update_option( $option, 'no' ); } } } } /** * Layout settings * * @access public * @return void */ public function layout_setting() { $templates = $this->templates(); $templates = apply_filters( 'sportspress_' . $this->template . '_templates', $templates ); $layout = get_option( 'sportspress_' . $this->template . '_template_order' ); if ( false === $layout ) { $layout = array_keys( $templates ); } $templates = array_merge( array_flip( (array) $layout ), $templates ); $slice = array_search( 'tabs', array_keys( $templates ) ); if ( $slice ) { $templates = array_slice( $templates, 0, $slice ); } ?>