Files
pterodactyl-panel/app/Console/Commands/Themes/ListCommand.php
T

31 lines
1.0 KiB
PHP
Raw Normal View History

2026-10-05 18:10:18 -04:00
<?php
declare(strict_types=1);
namespace Pterodactyl\Console\Commands\Themes;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
2026-10-12 07:47:42 -04:00
use Pterodactyl\Services\Themes\ThemeRepository;
2026-10-05 18:10:18 -04:00
2026-10-12 07:47:42 -04:00
#[Description('List the built-in and installed themes and which one is active.')]
2026-10-05 18:10:18 -04:00
#[Signature('p:theme:list')]
class ListCommand extends Command
{
2026-10-12 07:47:42 -04:00
public function handle(ThemeRepository $themes): int
2026-10-05 18:10:18 -04:00
{
2026-10-12 07:47:42 -04:00
$active = $themes->active();
$rows = [[ThemeRepository::CLASSIC, 'Classic', '', $active === ThemeRepository::CLASSIC ? 'active' : 'built in']];
foreach ($themes->installed() as $theme) {
$state = $theme->id === $active ? 'active' : 'available';
$problem = $themes->activationProblem($theme->id);
$rows[] = [$theme->id, $theme->name, $theme->theme?->extends, $problem === null ? $state : "{$state}, unusable: {$problem}"];
2026-10-05 18:10:18 -04:00
}
2026-10-12 07:47:42 -04:00
$this->table(['ID', 'Name', 'Extends', 'State'], $rows);
2026-10-05 18:10:18 -04:00
return self::SUCCESS;
}
}