Skip to content

Commit

Permalink
FEATURE: Add „back home“ command to go to preferred start module
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Jun 24, 2024
1 parent 540a605 commit 604abd7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Classes/Service/DataSource/CommandsDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Neos\Flow\I18n\Translator;
use Neos\Flow\Mvc\Routing\UriBuilder;
use Neos\Neos\Controller\Backend\MenuHelper;
use Neos\Neos\Service\BackendRedirectionService;
use Neos\Neos\Service\DataSource\AbstractDataSource;
use Shel\Neos\CommandBar\Domain\Dto\CommandDto;
use Shel\Neos\CommandBar\Helper\TranslationHelper;
Expand All @@ -28,7 +29,8 @@ class CommandsDataSource extends AbstractDataSource
public function __construct(
private readonly MenuHelper $menuHelper,
private readonly UriBuilder $uriBuilder,
private readonly Translator $translator
private readonly Translator $translator,
private readonly BackendRedirectionService $backendRedirectionService,
) {
}

Expand Down Expand Up @@ -85,6 +87,13 @@ function (array $carry, array $submodule) {
}, []);

$commands = [
'preferred-start-module' => new CommandDto(
'preferred-start-module',
$this->translate('CommandDataSource.command.preferredStartModule'),
$this->translate('CommandDataSource.command.preferredStartModule.description'),
$this->backendRedirectionService->getAfterLoginRedirectionUri($this->controllerContext),
'home'
),
'modules' => [
'name' => $this->translate('CommandDataSource.category.modules'),
'description' => $this->translate('CommandDataSource.category.modules.description'),
Expand Down
6 changes: 6 additions & 0 deletions Resources/Private/Translations/en/Main.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
<trans-unit id="CommandDataSource.category.modules.description">
<source>Open a backend module</source>
</trans-unit>
<trans-unit id="CommandDataSource.command.preferredStartModule">
<source>Back home</source>
</trans-unit>
<trans-unit id="CommandDataSource.command.preferredStartModule.description">
<source>Back to the start module</source>
</trans-unit>

<trans-unit id="CommandBarUiPlugin.command.switchEditPreviewMode">
<source>Switch edit/preview mode</source>
Expand Down

0 comments on commit 604abd7

Please sign in to comment.