FEATURE #2354 @2h30m: add pipeline for edit and create new content
This commit is contained in:
@@ -16,47 +16,6 @@ class ContactForm extends Handler implements ContentTitles, AdvancedContentModif
|
||||
return ContactFormHistory::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save module-specific values into database
|
||||
*
|
||||
* @param Content $content
|
||||
* @param array $inputData
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function createNew(Content &$content, array $inputData)
|
||||
{
|
||||
$settings = [
|
||||
'phone' => $inputData['phone'],
|
||||
'email' => $inputData['email'],
|
||||
'contactEmail' => $inputData['contactEmail'],
|
||||
'subject' => $inputData['subject'],
|
||||
'companyName' => $inputData['companyName'],
|
||||
'address' => $inputData['address'],
|
||||
'gpsLat' => $inputData['gpsLat'],
|
||||
'gpsLng' => $inputData['gpsLng'],
|
||||
];
|
||||
|
||||
// save settings
|
||||
$content->moduleSettings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for editing existing content page.
|
||||
*
|
||||
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
||||
*
|
||||
* @param Content $content
|
||||
* @param $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public static function edit(Content $content, $request)
|
||||
{
|
||||
self::createNew($content, $request);
|
||||
$content->save();
|
||||
}
|
||||
|
||||
public static function getModuleId()
|
||||
{
|
||||
$handler = config('contactform.handler');
|
||||
|
||||
Reference in New Issue
Block a user