current_setting_page = give_get_current_setting_page(); // Get current section. $this->current_section = give_get_current_setting_section(); add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 ); add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 ); add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) ); // Output sections. add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections', ) ); // Save hide button by default. $GLOBALS['give_hide_save_button'] = true; // Enable saving feature. if ( $this->enable_save ) { add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) ); } } /** * Get setting id * * @since 1.8.17 * @access public * @return string */ public function get_id() { return $this->id; } /** * Default setting tab. * * @since 1.8 * * @param $setting_tab * * @return string */ function set_default_setting_tab( $setting_tab ) { return $this->default_tab; } /** * Add this page to settings. * * @since 1.8 * * @param array $pages Lst of pages. * * @return array */ public function add_settings_page( $pages ) { $pages[ $this->id ] = $this->label; return $pages; } /** * Get settings array. * * @since 1.8 * @return array */ public function get_settings() { /** * Filter the settings. * * @since 1.8 * * @param array $settings */ $settings = apply_filters( 'give_get_settings_' . $this->id, array() ); // Output. return $settings; } /** * Get sections. * * @since 1.8 * @return array */ public function get_sections() { return apply_filters( 'give_get_sections_' . $this->id, array() ); } /** * Output sections. * * @since 1.8 * @return void */ public function output_sections() { // Get current section. $current_section = give_get_current_setting_section(); // Get all sections. $sections = $this->get_sections(); // Bailout. if ( empty( $sections ) ) { return; } // Show section settings only if setting section exist. if ( $current_section && ! in_array( $current_section, array_keys( $sections ), true ) ) { echo wp_kses_post( '
' . __( 'Oops, this settings page does not exist.', 'give' ) . '