Skip to content

Commit 970a0de

Browse files
committed
Rename trait
1 parent 05c66d5 commit 970a0de

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ContentResource extends Resource
136136

137137
### Making a resource page configurable
138138

139-
To make a resource page configurable, you need to add the `HasFieldsMapper` trait to your page. For this example, we'll make a `EditContent` page configurable.
139+
To make a resource page configurable, you need to add the `CanMapDynamicFields` trait to your page. For this example, we'll make a `EditContent` page configurable.
140140

141141
```php
142142
<?php
@@ -148,13 +148,13 @@ use Filament\Forms\Components\Tabs;
148148
use Filament\Forms\Components\Tabs\Tab;
149149
use Filament\Forms\Form;
150150
use Filament\Resources\Pages\EditRecord;
151-
use Vormkracht10\Fields\Concerns\HasFieldsMapper;
151+
use Vormkracht10\Fields\Concerns\CanMapDynamicFields;
152152

153153
class EditContent extends EditRecord
154154
{
155155
protected static string $resource = ContentResource::class;
156156

157-
use HasFieldsMapper;
157+
use CanMapDynamicFields;
158158

159159
public function form(Form $form): Form
160160
{
@@ -190,12 +190,12 @@ class FieldsRelationManager extends RelationManagersFieldsRelationManager
190190

191191
### Making a custom page configurable
192192

193-
To make a custom page configurable, you need to add the `HasFieldsMapper` trait to your page and set the `record` property on the page. This way the fields will be populated with the fields of the record.
193+
To make a custom page configurable, you need to add the `CanMapDynamicFields` trait to your page and set the `record` property on the page. This way the fields will be populated with the fields of the record.
194194

195195
```php
196196
class YourCustomPage extends Page
197197
{
198-
use HasFieldsMapper;
198+
use CanMapDynamicFields;
199199

200200
public $record;
201201

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Vormkracht10\Fields\Fields\Toggle;
2323
use Vormkracht10\Fields\Models\Field as Model;
2424

25-
trait HasFieldsMapper
25+
trait CanMapDynamicFields
2626
{
2727
private FieldInspector $fieldInspector;
2828

@@ -110,7 +110,7 @@ private function resolveFormFields(): array
110110
$customFields = $this->resolveCustomFields();
111111

112112
return $this->record->fields
113-
->map(fn ($field) => $this->resolveFieldInput($field, $customFields))
113+
->map(fn($field) => $this->resolveFieldInput($field, $customFields))
114114
->filter()
115115
->values()
116116
->all();
@@ -119,7 +119,7 @@ private function resolveFormFields(): array
119119
private function resolveCustomFields(): Collection
120120
{
121121
return collect(Fields::getFields())
122-
->map(fn ($fieldClass) => new $fieldClass);
122+
->map(fn($fieldClass) => new $fieldClass);
123123
}
124124

125125
private function resolveFieldInput(Model $field, Collection $customFields): ?object
@@ -138,4 +138,4 @@ private function resolveFieldInput(Model $field, Collection $customFields): ?obj
138138

139139
return null;
140140
}
141-
}
141+
}

0 commit comments

Comments
 (0)