Files
contact_form/Pipeline/SavePipeline/SaveContactInformation.php
T

39 lines
1.0 KiB
PHP
Executable File

<?php
namespace Modules\ContactForm\Pipeline\SavePipeline;
use App\CMS\Contracts\Content\SavePipeline\Process;
use App\Models\Content\Content;
use Modules\ContactForm\Handlers\ContactForm;
class SaveContactInformation implements Process
{
/**
* Process and modify given page
*
* @param Content $page
* @param array $input
*
* @return void>
*/
function handle(Content & $page, array & $input)
{
if (trim($page->moduleHandler, '\\') != ContactForm::class) {
return;
}
$settings = [
'phone' => $input['phone'],
'email' => $input['email'],
'contactEmail' => $input['contactEmail'],
'subject' => $input['subject'],
'companyName' => $input['companyName'],
'address' => $input['address'],
'gpsLat' => $input['gpsLat'],
'gpsLng' => $input['gpsLng'],
];
// save settings
$page->moduleSettings = $settings;
$page->save();
}
}