File: /home/zwafgyp/coolswim/wp-content/mu-plugins/ionos-help-center/inc/class-settings.php
<?php
namespace Ionos\Help_Center;
// Do not allow direct access!
use function defined;
if ( ! defined( 'ABSPATH' ) ) {
die();
}
/**
* Class Help_Center_Settings
*/
class Settings {
public function __construct() {
if ( is_admin() ) {
add_action( 'ionos_assistant_register_settings', array( $this, 'register_settings' ), 10, 2 );
}
}
/**
* creates settings option for IONOS Assistant Settings Page
*/
public function register_settings( $options_group_id, $branding_data ) {
if ( ! isset( $branding_data['name'] ) || \Ionos\Help_Center\Helper::get_config_parameter( 'enabled' ) !== '1' ) {
return null;
}
register_setting(
$options_group_id,
'ionos_help_center_enabled',
array( 'default' => '1' )
);
add_settings_section(
'ionos_help_center_integration_settings',
'',
'',
'ionos_assistant_settings_plugin'
);
add_settings_field(
'ionos_help_center_enabled',
sprintf(
__( '%s - Help', 'ionos-help-center' ),
$branding_data['name']
),
array( $this, 'help_center_settings' ),
'ionos_assistant_settings_plugin',
'ionos_help_center_integration_settings',
array(
'branding_data' => $branding_data,
)
);
}
public function help_center_settings( $args ) {
$option = get_option( 'ionos_help_center_enabled', '1' );
echo '<label for="ionos_help_center_enabled">';
echo '<input id="ionos_help_center_enabled" name="ionos_help_center_enabled" type="checkbox" value="1" ' . checked( '1', $option, false ) . ' />';
echo sprintf( __( 'Use %s help', 'ionos-help-center' ), $args['branding_data']['name'] . '</label>' );
}
}