Skip to content

Commit

Permalink
Moved settings to option page. Added wp_pca_settings method.
Browse files Browse the repository at this point in the history
  • Loading branch information
W1W1-M committed Apr 23, 2023
1 parent 63271d4 commit b41250f
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions admin/class-wp-pca-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ public function page_html( $wp_pca_logic ) {
</tr>
</table>
<h2>Your WP plugins</h2>
<?php $this->load_plugin_table( $wp_pca_logic ) ?>
<?php if ($this->get_pca_debug_info_option() == true) {$this->dump_plugin_metadata_debug_info($wp_pca_logic);} ?>
<?php
$this->load_plugin_table($wp_pca_logic);
$this->wp_pca_settings();
if ($this->get_pca_debug_info_option() == true) {
$this->dump_plugin_metadata_debug_info($wp_pca_logic);
}
?>
</div>
<?php
} else {
Expand Down Expand Up @@ -122,19 +127,19 @@ public function wp_pca_debug_info_settings_init() {
'default' => '0'
);
register_setting(
'general',
'wp_pca_options',
'wp_pca_debug_info_option',
$wp_pca_debug_info_args
);
add_settings_section(
'wp_pca_settings_section',
'WP Plugin Compatibility Assistant', array(&$this, 'wp_pca_settings_section_callback'),
'general'
'WP-PCA Settings', array(&$this, 'wp_pca_settings_section_callback'),
'wp-plugin-compatibility-assistant'
);
add_settings_field(
'wp_pca_settings_field',
'Debug info', array(&$this, 'wp_pca_settings_field_callback'),
'general',
'Show debug info', array(&$this, 'wp_pca_settings_field_callback'),
'wp-plugin-compatibility-assistant',
'wp_pca_settings_section'
);
}
Expand All @@ -149,7 +154,7 @@ public function sanitize_input_value( $input ) {
}

public function wp_pca_settings_section_callback() {
echo '<p>Settings</p>';
return;
}

public function wp_pca_settings_field_callback() {
Expand All @@ -163,6 +168,18 @@ public function get_pca_debug_info_option() {
$wp_pca_debug_info = get_option('wp_pca_debug_info_option', '0');
return $wp_pca_debug_info;
}

public function wp_pca_settings() {
?>
<form action="options.php" method="post">
<?php
settings_fields('wp_pca_options');
do_settings_sections('wp-plugin-compatibility-assistant');
submit_button('Save settings');
?>
</form>
<?php
}
}

?>

0 comments on commit b41250f

Please sign in to comment.