Skip to content
Snippets Groups Projects

Git submodules

Merged Lucas García requested to merge feat/submodules into main
4 files
+ 21
72
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 12
47
@@ -2,59 +2,24 @@
namespace WPCT_HTTP;
class Menu extends \WPCT_ABSTRACT\Singleton
{
private $name;
private $settings;
protected function __construct($name, $settings)
{
$this->name = $name;
$this->settings = $settings;
add_action('admin_menu', function () {
$this->add_menu();
});
use WPCT_ABSTRACT\Menu as BaseMenu;
add_action('admin_init', function () {
$this->settings->register();
});
}
private function add_menu()
{
add_options_page(
$this->name,
$this->name,
'manage_options',
$this->settings->get_name(),
function () {
$this->render_page();
},
);
}
class Menu extends BaseMenu
{
protected static $settings_class = '\WPCT_HTTP\Settings';
private function render_page()
protected function render_page()
{
ob_start();
?>
<div class="wrap">
?><div class="wrap">
<h1><?= $this->name ?></h1>
<form action="options.php" method="post">
<?php
settings_fields($this->settings->get_name());
do_settings_sections($this->settings->get_name());
submit_button();
?>
</form>
</div>
<?php
<form action="options.php" method="post"><?php
settings_fields($this->settings->get_group_name());
do_settings_sections($this->settings->get_group_name());
submit_button();
?></form>
</div><?php
$output = ob_get_clean();
echo apply_filters('wpct_http_menu_page_content', $output);
}
public function get_settings()
{
return $this->settings;
}
}
Loading