File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -348,7 +348,26 @@ $menu = (new CliMenuBuilder)
348
348
->build();
349
349
```
350
350
351
- Note: This will also disable the Go Back button for sub menus.
351
+ Note: This will also disable the Go Back button for sub menus.
352
+
353
+ You can manually add exit and go back buttons using the following:
354
+
355
+ ``` php
356
+ use PhpSchool\CliMenu\CliMenuBuilder;
357
+ use PhpSchool\CliMenu\Action\ExitAction;
358
+ use \PhpSchool\CliMenu\Action\GoBackAction;
359
+
360
+ require_once(__DIR__ . '/../vendor/autoload.php');
361
+
362
+ $menu = (new CliMenuBuilder)
363
+ ->disableDefaultItems()
364
+ ->addSubMenu('Super Sub Menu')
365
+ ->setTitle('Behold the awesomeness')
366
+ ->addItem('Return to parent menu', new GoBackAction) //add a go back button
367
+ ->end()
368
+ ->addItem('Leave this place now !', new ExitAction) //add an exit button
369
+ ->build();
370
+ ```
352
371
353
372
The marker displayed by the side of the currently active item can be modified, UTF-8 characters are supported.
354
373
The marker for un-selected items can also be modified. If you want to disable it, just set it to a space character.
You can’t perform that action at this time.
0 commit comments