mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-27 08:16:41 +01:00
Added theme whitelabel export functionality
This commit is contained in:
@@ -2188,6 +2188,32 @@ class AdminController extends AdminBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function taskExportScss()
|
||||
{
|
||||
if (!$this->authorizeTask('compile scss', ['admin.pages', 'admin.super'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = ['color_scheme' => $this->data['whitelabel']['color_scheme'] ?? null];
|
||||
$name = $this->data['whitelabel']['color_scheme']['name'] ?? 'theme';
|
||||
//todo slugify name
|
||||
$location = 'asset://' . $name . '.yaml';
|
||||
|
||||
[$status, $msg] = $this->grav['admin-whitelabel']->exportPresetScsss($data, $location);
|
||||
|
||||
$json_response = [
|
||||
'status' => 'success' ,
|
||||
'message' => 'Theme Export Ready',
|
||||
'files' => [
|
||||
'download' => Utils::url($location)
|
||||
]
|
||||
];
|
||||
|
||||
echo json_encode($json_response);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles deleting a media file from a page
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user