FEATURE #1551: add method for deleting extra content

This commit is contained in:
Michal Kváček
2016-04-11 01:20:11 +02:00
parent 951a8314b7
commit 288b1043b5
3 changed files with 20 additions and 0 deletions
+11
View File
@@ -53,6 +53,17 @@ interface AppHandler
*/
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?
*
+6
View File
@@ -5,6 +5,7 @@ use App\Enumerations\ModuleNamesWithIds;
use App\Enumerations\TemplatePathsHumanReadableRootOnly;
use App\Enumerations\WidgetTypes;
use App\Handlers\Contracts\AppHandler;
use App\Models\Content;
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()
{
return self::getExtendedFormInputsCreate();
@@ -228,6 +228,9 @@ class EditContent extends Controller
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?
if ($changedColumns == 0) {
return redirect()