Fix field render issues.
This commit is contained in:
@@ -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,14 +118,18 @@ 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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user