]> BookStack Code Mirror - bookstack/blobdiff - app/Theming/ThemeService.php
Support custom commands via logical theme system
[bookstack] / app / Theming / ThemeService.php
index 602abaf1c5a35e4845cbde67aec8981071271f5c..f095c7a8e7fb1716d4caa77495887acd2e51f898 100644 (file)
@@ -3,11 +3,17 @@
 namespace BookStack\Theming;
 
 use BookStack\Auth\Access\SocialAuthService;
+use Symfony\Component\Console\Command\Command;
 
 class ThemeService
 {
     protected $listeners = [];
 
+    /**
+     * @var Command[]
+     */
+    protected $commands = [];
+
     /**
      * Listen to a given custom theme event,
      * setting up the action to be ran when the event occurs.
@@ -43,6 +49,22 @@ class ThemeService
         return null;
     }
 
+    /**
+     * Register a new custom artisan command to be available.
+     */
+    public function registerCommand(Command $command)
+    {
+        $this->commands[] = $command;
+    }
+
+    /**
+     * Get the custom commands that have been registered.
+     */
+    public function getRegisteredCommands(): array
+    {
+        return $this->commands;
+    }
+
     /**
      * Read any actions from the set theme path if the 'functions.php' file exists.
      */