Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: RichEditor input type #21

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "joaopaulolndev/filament-general-settings",
"name": "untillnesss/filament-general-settings",
"description": "Filament package to manage general settings",
"keywords": [
"joaopaulolndev",
"untillnesss",
"laravel",
Comment on lines +5 to 6
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing to your name the package?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps, my bad. I just wanted to use this package locally using Composer, but it turns out the changes came here too.

"filament-general-settings"
],
"homepage": "/~https://github.com/joaopaulolndev/filament-general-settings",
"homepage": "/~https://github.com/untillnesss/filament-general-settings",
"support": {
"issues": "/~https://github.com/joaopaulolndev/filament-general-settings/issues",
"source": "/~https://github.com/joaopaulolndev/filament-general-settings"
"issues": "/~https://github.com/untillnesss/filament-general-settings/issues",
"source": "/~https://github.com/untillnesss/filament-general-settings"
},
"license": "MIT",
"authors": [
Expand Down
1 change: 1 addition & 0 deletions src/Enums/TypeFieldEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ enum TypeFieldEnum: string
case Select = 'select';
case Textarea = 'textarea';
case Datetime = 'datetime';
case Richtext = 'richtext';
}
7 changes: 7 additions & 0 deletions src/Forms/CustomForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
Expand Down Expand Up @@ -50,6 +51,12 @@ public static function get(array $customFields): array
->label(__($field['label']))
->placeholder(__($field['placeholder']))
->seconds($field['seconds']);
} elseif ($field['type'] === TypeFieldEnum::Richtext->value) {

$fields[] = RichEditor::make($fieldKey)
->label(__($field['label']))
->placeholder(__($field['placeholder']));

}
}

Expand Down
12 changes: 12 additions & 0 deletions src/Pages/GeneralSettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@ public function mount(): void
'name' => $this->data['site_favicon'],
];
}

$this->fillMoreConfigKeys();
}

public function fillMoreConfigKeys() {
if(config('filament-general-settings.show_custom_tabs')){
foreach (config('filament-general-settings.custom_tabs') as $key => $customTab) {
if(!isset($this->data['more_configs'][$key])){
$this->data['more_configs'][$key] = null;
}
}
}
}

public function form(Form $form): Form
Expand Down