Fix field render issues.

This commit is contained in:
dcooperdalrymple
2024-09-06 17:03:18 -05:00
parent 081b99bc23
commit 88ae54fb6f

View File

@@ -90,7 +90,8 @@ class Settings {
Plugin::__('Client ID'), Plugin::__('Client ID'),
[$this, 'the_field'], [$this, 'the_field'],
$this->get_menu_slug(), $this->get_menu_slug(),
'api' 'api',
['name' => 'client_id']
); );
add_settings_field( add_settings_field(
@@ -98,7 +99,8 @@ class Settings {
Plugin::__('Client Secret'), Plugin::__('Client Secret'),
[$this, 'the_field'], [$this, 'the_field'],
$this->get_menu_slug(), $this->get_menu_slug(),
'api' 'api',
['name' => 'client_secret']
); );
add_settings_field( add_settings_field(
@@ -106,7 +108,8 @@ class Settings {
Plugin::__('Token'), Plugin::__('Token'),
[$this, 'the_field'], [$this, 'the_field'],
$this->get_menu_slug(), $this->get_menu_slug(),
'api' 'api',
['name' => 'token']
); );
} }
@@ -115,15 +118,19 @@ class Settings {
printf( printf(
'<input id="%s" name="%s[%s]" type="text" value="%s" />', '<input id="%s" name="%s[%s]" type="text" value="%s" />',
esc_attr($args['name']), esc_attr($args['name']),
esc_attr($args['option_group']), esc_attr($this->get_option_group()),
esc_attr($args['name']), esc_attr($args['name']),
esc_attr($this->options[$args['name']] ?? '') esc_attr($this->get_field($args['name']))
); );
if (isset($args['description']) && !empty($args['description'])) { if (isset($args['description']) && !empty($args['description'])) {
printf('<p class="description">%s</p>', esc_html($args['description'])); printf('<p class="description">%s</p>', esc_html($args['description']));
} }
} }
public function sanitize(array $input):array {
return array_map('sanitize_text_field', $input);
}
// Output settings page // Output settings page
public function render():void { public function render():void {