tab_text ) ) {
$this->tab_text = $this->title;
}
// Register the settings section.
$this->register_section();
}
/**
* Register settings section.
*/
public function register_section() {
add_settings_section(
$this->name,
$this->title,
array( $this, 'print_section_info' ),
$this->settings_key
);
$this->register_fields();
register_setting(
$this->settings_key,
$this->settings_key,
array( $this, 'sanitize_settings' )
);
}
/**
* Register fields for this section
*/
abstract public function register_fields();
/**
* Prints help info for this section
*/
abstract public function print_section_info();
/**
* Returns the URL for the ConvertKit documentation for this setting section.
*/
abstract public function documentation_url();
/**
* Renders the section
*/
public function render() {
/**
* Performs actions prior to rendering the settings form.
*
* @since 1.9.6
*/
do_action( 'convertkit_settings_base_render_before' );
$this->render_container_start();
do_settings_sections( $this->settings_key );
settings_fields( $this->settings_key );
submit_button();
$this->render_container_end();
/**
* Performs actions after rendering of the settings form.
*
* @since 1.9.6
*/
do_action( 'convertkit_settings_base_render_after' );
}
/**
* Outputs .metabox-holder and .postbox container div elements,
* used before beginning a setting screen's output.
*
* @since 2.0.0
*/
public function render_container_start() {
?>
'_wp_convertkit_settings',
'tab' => $this->name,
);
if ( $error !== false ) {
$args['error'] = $error;
}
if ( $success !== false ) {
$args['success'] = $success;
}
// Redirect.
wp_safe_redirect( add_query_arg( $args, 'options-general.php' ) );
exit();
}
/**
* Outputs the given success message in an inline notice.
*
* @since 2.0.0
*
* @param string $success_message Success Message.
*/
public function output_success( $success_message ) {
?>