Feat: Implement Admin class structure and instantiate in Plugin

This commit is contained in:
2025-04-18 18:29:11 +01:00
parent bcdbbb454c
commit b18f1c46b4
2 changed files with 60 additions and 0 deletions

50
includes/Admin/Admin.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/**
* Admin area functionality for the plugin.
*
* @package WPALLSTARS\PluginStarterTemplate\Admin
*/
namespace WPALLSTARS\PluginStarterTemplate\Admin;
use WPALLSTARS\PluginStarterTemplate\Core;
/**
* Admin class responsible for admin-specific hooks and functionality.
*/
class Admin {
/**
* Core plugin class instance.
*
* @var Core
*/
private $core;
/**
* Constructor.
*
* @param Core $core Core instance.
*/
public function __construct( Core $core ) {
$this->core = $core;
$this->initialize_hooks();
}
/**
* Initializes WordPress hooks.
*/
private function initialize_hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
}
/**
* Enqueues admin-specific assets.
*
* @param string $hook_suffix The current admin page.
*/
public function enqueue_admin_assets( $hook_suffix ) {
// Admin assets enqueue logic will go here.
// The test mocks wp_enqueue_style, wp_enqueue_script, etc.
}
}

View File

@@ -7,6 +7,8 @@
namespace WPALLSTARS\PluginStarterTemplate;
use WPALLSTARS\PluginStarterTemplate\Admin\Admin;
/**
* Plugin class
*/
@@ -19,6 +21,13 @@ class Plugin {
*/
private $core;
/**
* Admin instance
*
* @var Admin
*/
private $admin;
/**
* Plugin file
*
@@ -43,6 +52,7 @@ class Plugin {
$this->plugin_file = $plugin_file;
$this->version = $version;
$this->core = new Core();
$this->admin = new Admin( $this->core );
}
/**