Skip to content

Commit 15b6753

Browse files
author
antoine
committed
add ->html() action to commands
1 parent da6743f commit 15b6753

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/guide/commands.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Finally, let's review the return possibilities: after a Command has been execute
167167
- `return $this->reload()`: reload the current page (with context).
168168
- `return $this->refresh(1)`*: refresh only the instance with an id on `1`. We can pass an id array also to refresh more than one instance.
169169
- `return $this->view('view.name', ['some'=>'params'])`: display a view right in Sharp; useful for page previews.
170+
- `return $this->html('...')`: display an HTML content.
170171
- `return $this->link('/path/to/redirect')`: redirect to the given path.
171172
- `return $this->download('path', 'diskName')`: the browser will download the specified file.
172173
- `return $this->streamDownload('path', 'name')`: the browser will stream the specified file.
@@ -416,4 +417,4 @@ class MyBulkCommand extends EntityCommand
416417

417418
## Wizard Commands
418419

419-
A Wizard Command is a special kind of Command that will be executed in a modal, and will be able to display several steps to the user. See [dedicated documentation here](commands-wizard.md).
420+
A Wizard Command is a special kind of Command that will be executed in a modal, and will be able to display several steps to the user. See [dedicated documentation here](commands-wizard.md).

src/EntityList/Commands/Command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ protected function view(string $bladeView, array $params = []): array
6262
'html' => view($bladeView, $params)->render(),
6363
];
6464
}
65+
66+
protected function html(string $htmlContent): array
67+
{
68+
return [
69+
'action' => 'view',
70+
'html' => $htmlContent,
71+
];
72+
}
6573

6674
protected function download(string $filePath, string $fileName = null, string $diskName = null): array
6775
{

0 commit comments

Comments
 (0)