FEATURE #1551: add method for deleting extra content
This commit is contained in:
@@ -53,6 +53,17 @@ interface AppHandler
|
|||||||
*/
|
*/
|
||||||
public static function edit(Content &$content, Request $request, $revisionID);
|
public static function edit(Content &$content, Request $request, $revisionID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called right after content page is marked as deleted
|
||||||
|
*
|
||||||
|
* This method is supposed to clean after "deleted" page.
|
||||||
|
*
|
||||||
|
* @param Content $content
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public static function delete(Content $content);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does given module manage content? Or is it just module with widgets/something internal/something absolutely else?
|
* Does given module manage content? Or is it just module with widgets/something internal/something absolutely else?
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use App\Enumerations\ModuleNamesWithIds;
|
|||||||
use App\Enumerations\TemplatePathsHumanReadableRootOnly;
|
use App\Enumerations\TemplatePathsHumanReadableRootOnly;
|
||||||
use App\Enumerations\WidgetTypes;
|
use App\Enumerations\WidgetTypes;
|
||||||
use App\Handlers\Contracts\AppHandler;
|
use App\Handlers\Contracts\AppHandler;
|
||||||
|
use App\Models\Content;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +43,11 @@ abstract class Handler implements AppHandler
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function delete(Content $content)
|
||||||
|
{
|
||||||
|
// temporarily nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
public static function getExtendedFormInputsEdit()
|
public static function getExtendedFormInputsEdit()
|
||||||
{
|
{
|
||||||
return self::getExtendedFormInputsCreate();
|
return self::getExtendedFormInputsCreate();
|
||||||
|
|||||||
@@ -228,6 +228,9 @@ class EditContent extends Controller
|
|||||||
|
|
||||||
list ($revision, $changedColumns) = $page->updateWithHistory(['status' => 'status'], ['status' => Content::STATUS_DELETED]);
|
list ($revision, $changedColumns) = $page->updateWithHistory(['status' => 'status'], ['status' => Content::STATUS_DELETED]);
|
||||||
|
|
||||||
|
// let module to delete some extra content created during page's life
|
||||||
|
call_user_func([$page->module_handler, 'delete'], $page);
|
||||||
|
|
||||||
// was something changed?
|
// was something changed?
|
||||||
if ($changedColumns == 0) {
|
if ($changedColumns == 0) {
|
||||||
return redirect()
|
return redirect()
|
||||||
|
|||||||
Reference in New Issue
Block a user