give filled and translated action properties
This commit is contained in:
parent
5c837b9d31
commit
e7ad6b0178
@ -59,9 +59,9 @@ class Backend extends dcNsProcess
|
|||||||
foreach ($uninstaller->getDirectActions($define->getId()) as $cleaner => $stack) {
|
foreach ($uninstaller->getDirectActions($define->getId()) as $cleaner => $stack) {
|
||||||
foreach ($stack as $action) {
|
foreach ($stack as $action) {
|
||||||
if ($uninstaller->execute($cleaner, $action['action'], $action['ns'])) {
|
if ($uninstaller->execute($cleaner, $action['action'], $action['ns'])) {
|
||||||
$done[] = sprintf($action['success'], $action['ns']);
|
$done[] = $action['success'];
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->error->add(sprintf($action['error'], $action['ns']));
|
dcCore::app()->error->add($action['error']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ class Manage extends dcNsProcess
|
|||||||
foreach ($stack as $action) {
|
foreach ($stack as $action) {
|
||||||
if (isset($_POST['action'][$cleaner]) && isset($_POST['action'][$cleaner][$action['action']])) {
|
if (isset($_POST['action'][$cleaner]) && isset($_POST['action'][$cleaner][$action['action']])) {
|
||||||
if ($uninstaller->execute($cleaner, $action['action'], $_POST['action'][$cleaner][$action['action']])) {
|
if ($uninstaller->execute($cleaner, $action['action'], $_POST['action'][$cleaner][$action['action']])) {
|
||||||
$done[] = sprintf($action['success'], $_POST['action'][$cleaner][$action['action']]);
|
$done[] = $action['success'];
|
||||||
} else {
|
} else {
|
||||||
dcCore::app()->error->add(sprintf($action['error'], $_POST['action'][$cleaner][$action['action']]));
|
dcCore::app()->error->add($action['error']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ class Manage extends dcNsProcess
|
|||||||
foreach ($stack as $action) {
|
foreach ($stack as $action) {
|
||||||
$fields[] = (new Para())->items([
|
$fields[] = (new Para())->items([
|
||||||
(new Checkbox(['action[' . $cleaner . '][' . $action['action'] . ']', 'action_' . $cleaner . '_' . $action['action']], true))->value($action['ns']),
|
(new Checkbox(['action[' . $cleaner . '][' . $action['action'] . ']', 'action_' . $cleaner . '_' . $action['action']], true))->value($action['ns']),
|
||||||
(new Label(sprintf($action['query'], $action['ns']), Label::OUTSIDE_LABEL_AFTER))->for('action_' . $cleaner . '_' . $action['action'])->class('classic'),
|
(new Label($action['query'], Label::OUTSIDE_LABEL_AFTER))->for('action_' . $cleaner . '_' . $action['action'])->class('classic'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,22 +262,22 @@ class Uninstaller
|
|||||||
|
|
||||||
private function addAction(string $group, string $cleaner, string $action, string $ns): void
|
private function addAction(string $group, string $cleaner, string $action, string $ns): void
|
||||||
{
|
{
|
||||||
if (!self::group($group) || null === $this->module) {
|
// invalid group or no current module or no cleaner id or ns
|
||||||
return;
|
if (!self::group($group) || null === $this->module || empty($cleaner) || empty($ns)) {
|
||||||
}
|
|
||||||
if (empty($cleaner) || empty($ns)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// unknow cleaner action
|
||||||
if (!isset($this->cleaners->get($cleaner)->actions[$action])) {
|
if (!isset($this->cleaners->get($cleaner)->actions[$action])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->actions[$group][$this->module->getId()][$cleaner][] = array_merge(
|
// fill action properties
|
||||||
[
|
$this->actions[$group][$this->module->getId()][$cleaner][] = [
|
||||||
'ns' => $ns,
|
'ns' => $ns,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
],
|
'query' => sprintf($this->cleaners->get($cleaner)->actions[$action]->query, $ns),
|
||||||
$this->cleaners->get($cleaner)->actions[$action]->dump()
|
'success' => sprintf($this->cleaners->get($cleaner)->actions[$action]->success, $ns),
|
||||||
);
|
'error' => sprintf($this->cleaners->get($cleaner)->actions[$action]->error, $ns),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getActions(string $group, string $id): array
|
private function getActions(string $group, string $id): array
|
||||||
|
Loading…
Reference in New Issue
Block a user