Skip to content

Commit 481e3ba

Browse files
cklei-carlygithub-actions[bot]
authored andcommitted
Fix styling
1 parent c533452 commit 481e3ba

4 files changed

Lines changed: 50 additions & 50 deletions

File tree

src/Fields/Configs/Attributes/Translatable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ class Translatable
1212
{
1313
public function __construct(
1414
public bool $translatable = true,
15-
) { }
15+
) {}
1616
}

src/Fields/Configs/Concerns/HasInnerField.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,58 +29,58 @@ protected static function getHasInnerFieldComponent()
2929
};
3030

3131
return Forms\Components\Repeater::make('fields')
32-
->columnSpanFull()
33-
->collapsible()
34-
->itemLabel(fn (array $state): ?string => $state['name'] ?? null)
35-
->addActionLabel('Add Field')
36-
->schema(static::getHasInnerFieldFieldsSchema())
37-
->defaultItems(1)
38-
->extraItemActions([
39-
Forms\Components\Actions\Action::make('editConfig')
40-
->icon('heroicon-s-cog-8-tooth')
41-
->slideOver()
42-
// todo: add translation
43-
->modalHeading(fn (array $arguments, Forms\Components\Repeater $component) => str_replace([':field'], [$getFieldForRepeaterAction($arguments, $component) ?? 'Field'], 'Edit :field configuration'))
44-
->modalIcon(fn (array $arguments, Forms\Components\Repeater $component) => $getFieldIconForRepeaterAction($arguments, $component))
45-
->disabled(fn (array $arguments, Forms\Components\Repeater $component) => empty($getFieldForRepeaterAction($arguments, $component)))
46-
->form(function (Forms\Form $form, array $arguments, Forms\Components\Repeater $component) use ($getFieldForRepeaterAction) {
47-
48-
$innerFieldTypeName = $getFieldForRepeaterAction($arguments, $component);
49-
50-
if (filled($innerFieldTypeName) &&
51-
($fieldTypeConfig = FieldTypeHelper::getFieldTypeConfig($innerFieldTypeName))
52-
) {
53-
if ($fieldTypeConfig->isFieldTypeTranslatable()) {
54-
// display "translatable" field for the field type
55-
return $fieldTypeConfig->getEnhancedFormSchema();
56-
} else {
57-
return $fieldTypeConfig->getFormSchema();
58-
}
32+
->columnSpanFull()
33+
->collapsible()
34+
->itemLabel(fn (array $state): ?string => $state['name'] ?? null)
35+
->addActionLabel('Add Field')
36+
->schema(static::getHasInnerFieldFieldsSchema())
37+
->defaultItems(1)
38+
->extraItemActions([
39+
Forms\Components\Actions\Action::make('editConfig')
40+
->icon('heroicon-s-cog-8-tooth')
41+
->slideOver()
42+
// todo: add translation
43+
->modalHeading(fn (array $arguments, Forms\Components\Repeater $component) => str_replace([':field'], [$getFieldForRepeaterAction($arguments, $component) ?? 'Field'], 'Edit :field configuration'))
44+
->modalIcon(fn (array $arguments, Forms\Components\Repeater $component) => $getFieldIconForRepeaterAction($arguments, $component))
45+
->disabled(fn (array $arguments, Forms\Components\Repeater $component) => empty($getFieldForRepeaterAction($arguments, $component)))
46+
->form(function (Forms\Form $form, array $arguments, Forms\Components\Repeater $component) use ($getFieldForRepeaterAction) {
47+
48+
$innerFieldTypeName = $getFieldForRepeaterAction($arguments, $component);
49+
50+
if (filled($innerFieldTypeName) &&
51+
($fieldTypeConfig = FieldTypeHelper::getFieldTypeConfig($innerFieldTypeName))
52+
) {
53+
if ($fieldTypeConfig->isFieldTypeTranslatable()) {
54+
// display "translatable" field for the field type
55+
return $fieldTypeConfig->getEnhancedFormSchema();
56+
} else {
57+
return $fieldTypeConfig->getFormSchema();
5958
}
59+
}
6060

61-
return [];
62-
})
63-
->fillForm(function (array $arguments, Forms\Components\Repeater $component) use ($getItemStateForRepeaterAction) {
64-
$existingFieldConfig = $getItemStateForRepeaterAction($arguments, $component)['fieldConfig'];
65-
if (! empty($existingFieldConfig)) {
66-
return $existingFieldConfig;
67-
}
68-
})
69-
->action(function (array $data, array $arguments, Forms\Components\Repeater $component) use ($getItemKeyForRepeaterAction) {
61+
return [];
62+
})
63+
->fillForm(function (array $arguments, Forms\Components\Repeater $component) use ($getItemStateForRepeaterAction) {
64+
$existingFieldConfig = $getItemStateForRepeaterAction($arguments, $component)['fieldConfig'];
65+
if (! empty($existingFieldConfig)) {
66+
return $existingFieldConfig;
67+
}
68+
})
69+
->action(function (array $data, array $arguments, Forms\Components\Repeater $component) use ($getItemKeyForRepeaterAction) {
7070

71-
$itemKey = $getItemKeyForRepeaterAction($arguments);
71+
$itemKey = $getItemKeyForRepeaterAction($arguments);
7272

73-
$itemState = $component->getRawItemState($itemKey);
73+
$itemState = $component->getRawItemState($itemKey);
7474

75-
$itemState['fieldConfig'] = $data;
75+
$itemState['fieldConfig'] = $data;
7676

77-
$component->getChildComponentContainer($itemKey)->fill($itemState);
77+
$component->getChildComponentContainer($itemKey)->fill($itemState);
7878

79-
$component->collapsed(false, shouldMakeComponentCollapsible: false);
79+
$component->collapsed(false, shouldMakeComponentCollapsible: false);
8080

81-
$component->callAfterStateUpdated();
82-
}),
83-
]);
81+
$component->callAfterStateUpdated();
82+
}),
83+
]);
8484
}
8585

8686
protected static function getHasInnerFieldFieldsSchema(): array
@@ -108,7 +108,7 @@ protected static function getHasInnerFieldFieldsSchema(): array
108108
->required()
109109
->helperText('Label for the field')
110110
->live()->afterStateUpdated(fn ($state, $set) => $state ? $set('name', Str::slug($state)) : null),
111-
111+
112112
Forms\Components\TextInput::make('name')
113113
->required()
114114
->helperText('Unique name for the field'),

src/Fields/Mixins/SimpleFieldDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace SolutionForest\InspireCms\Fields\Mixins;
44

5-
use ReflectionClass;
65
use ReflectionAttribute;
6+
use ReflectionClass;
77

88
class SimpleFieldDefinition
99
{
1010
public function getAttributes()
1111
{
1212
return function () {
1313
$reflection = new ReflectionClass(static::class);
14-
14+
1515
return $reflection->getAttributes();
1616
};
1717
}

src/Filament/Clusters/Content/Resources/BaseContentResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static function form(Form $form): Form
126126
$documentType = $livewire->getDocumentType();
127127

128128
$tabs[] = static::getPropertyDataValueComponent(isTab: true);
129-
129+
130130
if ($documentType->display_category != \SolutionForest\InspireCms\Base\Enums\DocumentTypeCategory::Data) {
131131
$tabs[] = Forms\Components\Tabs\Tab::make('seo')
132132
->label(__('inspirecms::resources/content.seo.tab.label'))
@@ -629,7 +629,7 @@ protected static function getPropertyDataValueComponent(bool $isTab = false)
629629
$fieldGroups = $getFieldGroupsFromLivewireOrRecord($livewire, $record);
630630

631631
$groupComponents = [];
632-
632+
633633
foreach ($fieldGroups as $fieldGroupModel) {
634634

635635
$groupComponents[] = $fieldGroupModel->toFilamentComponent();

0 commit comments

Comments
 (0)