diff --git a/src/EntityList/Commands/Command.php b/src/EntityList/Commands/Command.php index f0cce508b..8850ee697 100644 --- a/src/EntityList/Commands/Command.php +++ b/src/EntityList/Commands/Command.php @@ -9,6 +9,7 @@ use Code16\Sharp\Utils\Fields\FieldsContainer; use Code16\Sharp\Utils\Fields\HandleFormFields; use Code16\Sharp\Utils\SharpNotification; +use Code16\Sharp\Utils\Traits\HandleLocalizedFields; use Code16\Sharp\Utils\Traits\HandlePageAlertMessage; use Code16\Sharp\Utils\Traits\HandleValidation; use Code16\Sharp\Utils\Transformers\WithCustomTransformers; @@ -20,6 +21,7 @@ abstract class Command use HandleValidation; use HasModalFormLayout; use WithCustomTransformers; + use HandleLocalizedFields; protected int $groupIndex = 0; protected ?string $commandKey = null; diff --git a/src/Http/Controllers/Api/Commands/HandlesCommandForm.php b/src/Http/Controllers/Api/Commands/HandlesCommandForm.php index 674cd5b63..6b96f0fa8 100644 --- a/src/Http/Controllers/Api/Commands/HandlesCommandForm.php +++ b/src/Http/Controllers/Api/Commands/HandlesCommandForm.php @@ -14,8 +14,6 @@ protected function getCommandForm(InstanceCommand|EntityCommand|DashboardCommand return []; } - $locales = $commandHandler->getDataLocalizations(); - return [ 'fields' => $formFields, 'layout' => $commandHandler->formLayout(), @@ -26,9 +24,9 @@ protected function getCommandForm(InstanceCommand|EntityCommand|DashboardCommand 'description' => $commandHandler->getFormModalDescription($formData) ?? $commandHandler->getDescription(), 'buttonLabel' => $commandHandler->getFormModalButtonLabel(), ], - ...$locales ? [ - 'locales' => $locales, - ] : [], + 'locales' => $commandHandler->hasDataLocalizations() + ? $commandHandler->getDataLocalizations() + : null, ]; } }