Add contact settings integration: update contact page to utilize dynamic settings for subtitle, header, paragraph, contact details, and map embed URL, enhancing content management and user experience.
This commit is contained in:
87
app/Filament/Pages/ContactPageSettings.php
Normal file
87
app/Filament/Pages/ContactPageSettings.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\ContactSettings;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class ContactPageSettings extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'CMS';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-phone';
|
||||
|
||||
protected static string $settings = ContactSettings::class;
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('Contact Section')
|
||||
->description('Manage the contact page content.')
|
||||
->schema([
|
||||
TextInput::make('contact_subtitle')
|
||||
->label('Subtitle')
|
||||
->maxLength(100)
|
||||
->required(),
|
||||
TextInput::make('contact_header')
|
||||
->label('Header')
|
||||
->maxLength(100)
|
||||
->required(),
|
||||
Textarea::make('contact_paragraph')
|
||||
->label('Paragraph')
|
||||
->rows(3)
|
||||
->maxLength(65535)
|
||||
->required(),
|
||||
TextInput::make('phone_number')
|
||||
->label('Phone Number')
|
||||
->tel()
|
||||
->required(),
|
||||
TextInput::make('email_address')
|
||||
->label('Email Address')
|
||||
->email()
|
||||
->required(),
|
||||
TextInput::make('location_address')
|
||||
->label('Location Address')
|
||||
->maxLength(255)
|
||||
->required(),
|
||||
TextInput::make('map_embed_url')
|
||||
->label('Google Maps Embed URL')
|
||||
->url()
|
||||
->required(),
|
||||
])
|
||||
])
|
||||
->columns(1)
|
||||
->statePath('data');
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Contact Page Settings');
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return 'Contact Page';
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable
|
||||
{
|
||||
return 'Edit contact page text and information from here';
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Manage the contact form details, contact information, and map embed.';
|
||||
}
|
||||
}
|
||||
27
app/Settings/ContactSettings.php
Normal file
27
app/Settings/ContactSettings.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class ContactSettings extends Settings
|
||||
{
|
||||
public string $contact_subtitle = 'Default Contact Subtitle';
|
||||
|
||||
public string $contact_header = 'Default Contact Header';
|
||||
|
||||
public string $contact_paragraph = 'This is a default paragraph for the contact page. Please update it from the Filament panel.';
|
||||
|
||||
public string $phone_number = '+1234567890';
|
||||
|
||||
public string $email_address = 'info@example.com';
|
||||
|
||||
public string $location_address = '123 Main St, Anytown, USA';
|
||||
|
||||
public string $map_embed_url = '';
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'contact';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user