Skip to content

Commit cbfb508

Browse files
pauldwightifox
authored andcommitted
updates to the docs for nested modules
1 parent f23eeed commit cbfb508

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/content/1_docs/3_modules/12_nested-modules.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ $slug = $item->getNestedSlug($lang);
3939
To include all ancestor slugs in the permalink of an item in the CMS, you can dynamically set the `$permalinkBase` property from the `form()` method of your module controller:
4040

4141
```php
42-
class PageController extends ModuleController
42+
class PageController extends NestedModuleController
4343
{
4444
//...
4545

46-
protected function form($id, $item = null)
46+
protected function form(?int $id, TwillModelContract $item = null): array
4747
{
4848
$item = $this->repository->getById($id, $this->formWith, $this->formWithCount);
4949

@@ -71,6 +71,21 @@ Route::get('{slug}', function ($slug) {
7171
For more information on how to work with nested items in your application, you can refer to the
7272
[laravel-nestedset package documentation](https://github.com/lazychaser/laravel-nestedset#retrieving-nodes).
7373

74+
### Setting a maximum nested depth
75+
76+
You can also define the maximum depth allowed for the module changing the following:
77+
```php
78+
protected $nestedItemsDepth = 1;
79+
```
80+
Note: a depth of 1 means parent and child.
81+
82+
### Working with browser fields
83+
84+
By default only a parent item will be visible to the browser field. If you want to show child items when browsing for the module you can set `$showOnlyParentItemsInBrowsers` to false:
85+
```php
86+
protected $showOnlyParentItemsInBrowsers = false; // default is true
87+
```
88+
7489
## Parent-child modules
7590

7691
Parent-child modules are 2 distinct modules, where items of the child module are attached to items of the parent module (e.g. Issues can contain Articles):

0 commit comments

Comments
 (0)