FEATURE: add language to content pages
This commit is contained in:
@@ -17,6 +17,7 @@ use App\Models\File;
|
||||
use App\Models\Template;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Str;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class EditContent extends Controller
|
||||
@@ -65,8 +66,8 @@ class EditContent extends Controller
|
||||
'contentStatuses' => $statuses,
|
||||
'page' => $page,
|
||||
'rootPages' => $page->getOverview()
|
||||
->where('contents.id', '!=', $page->id)
|
||||
->get(),
|
||||
->where('contents.id', '!=', $page->id)
|
||||
->get(),
|
||||
'templates' => $templates,
|
||||
'extraData' => call_user_func([$page->module_handler, 'loadExtraData'], $page),
|
||||
'formSectionNames' => call_user_func([$page->module_handler, 'getExtendedFormSections']),
|
||||
@@ -223,14 +224,14 @@ class EditContent extends Controller
|
||||
|
||||
// change url to something unique
|
||||
$oldURL = $page->url;
|
||||
$page->url = uniqid($page->url.'_deleted');
|
||||
$page->url = uniqid($page->url . '_deleted');
|
||||
$page->save();
|
||||
|
||||
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()
|
||||
@@ -274,6 +275,7 @@ class EditContent extends Controller
|
||||
|
||||
// disable any other existing homepage
|
||||
Content::where('is_homepage', 1)
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->update(['is_homepage' => 0]);
|
||||
|
||||
// set new homepage
|
||||
|
||||
Reference in New Issue
Block a user