Skip to content

Commit a950ef4

Browse files
committed
Augment Structures Fieldtype data
1 parent f354433 commit a950ef4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Structures/Structure.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
use Illuminate\Support\Traits\Tappable;
66
use Statamic\Contracts\Structures\Structure as StructureContract;
7+
use Statamic\Contracts\Data\Augmentable;
8+
use Statamic\Data\HasAugmentedData;
79
use Statamic\Facades;
810
use Statamic\Support\Str;
911
use Statamic\Support\Traits\FluentlyGetsAndSets;
1012

11-
abstract class Structure implements StructureContract
13+
abstract class Structure implements StructureContract, Augmentable
1214
{
1315
use FluentlyGetsAndSets, Tappable;
1416

@@ -19,6 +21,8 @@ abstract class Structure implements StructureContract
1921
protected $maxDepth;
2022
protected $expectsRoot = false;
2123

24+
use HasAugmentedData;
25+
2226
public function id()
2327
{
2428
return $this->handle();
@@ -115,4 +119,12 @@ public static function __callStatic($method, $parameters)
115119
{
116120
return Facades\Structure::{$method}(...$parameters);
117121
}
122+
123+
public function augmentedArrayData()
124+
{
125+
return [
126+
'title' => $this->title(),
127+
'handle' => $this->handle()
128+
];
129+
}
118130
}

0 commit comments

Comments
 (0)