File: D:/HostingSpaces/SBogers10/bomacon.komma.pro/vendor/komma/kms/src/Transfer/TransferSection.php
<?php
namespace Komma\KMS\Transfer;
//The new object oriented attributes
use Komma\KMS\Helpers\KommaHelpers;
use Komma\KMS\Core\Sections\Section;
use Komma\KMS\Core\Sections\Tabs\Collections\NoLanguageTabs;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\MessageBag;
use Illuminate\View\View;
class TransferSection extends Section
{
protected $packagePrefix = 'KMS::';
protected $title = "Importeren";
protected $subtitle = "All pages";
protected $slug = "transfer";
protected $hasRoutes = true;
public $showSave = 'all';
public $showDelete = [];
public $showCreate = [];
/**
* PageSection constructor.
*/
// function __construct(Kms $kms, PageRepository $repository)
function __construct()
{
$this->title = ucfirst(__('KMS::kms/transfer.transfer'));
$this->subtitle = __('KMS::kms/transfer.transfersubtitle');
$sectionTabDirector = new NoLanguageTabs();
parent::__construct($sectionTabDirector, $this->slug);
$this->submitButtonLabel = __('KMS::kms/transfer.transfer');
}
/**
* Generates the attributes for this section. They all must extend the App\Kms\Core\Attributes\Attribute class
* This is the place where you need to setup your sections appearance. Just make sure you build an array of attributes
* and put each attribute in a AbstractSectionTabItem with a SectionTabGroups constant to link them to a tab.
*
* @see PageRepository::saveModel()
* @param Model $currentModel
* @return Collection A collection of SectionTabItems
*/
protected function generateAttributes(Model $currentModel = null): Collection
{
// Note: The "attributes are hardcoded in transfer.blade.php because this method isn't giving is the right amount of flexibility right now"
//
// //*****************************************************************************************\\
// //*** Define attribute validation sets ***\\
// //*****************************************************************************************\\
// //*****************************************************************************************\\
// //*** Generate the attributes ***\\
// //*****************************************************************************************\\
//
// //****************************************************************************************************************************************\\
// //*** Put the all attributes in a SectionTabItem so we can track for which tab they are. And then put SectionTabItems in a Collection ***\\
// //****************************************************************************************************************************************\\
$tabItems = new Collection();
// foreach($attributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::General));
// foreach($languageIndexedAttributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::Languages));
//
return $tabItems;
}
/**
* Makes the view and returns it
*
* @return View
*/
protected function makeView(): View
{
$successes = (Session::has('successes')) ? Session::get('successes') : new MessageBag();
return view('KMS::kms/section.transfer', [
'section' => $this,
'importRoute' => [
'route' => route('transfer.import'),
'method' => 'POST'
],
'exportRoute' => [
'route' => route('transfer.export'),
'method' => 'POST'
],
'importDocumentsRoute' => [
'route' => route('transfer.import_documents'),
'method' => 'POST'
],
'successes' => $successes,
'maxUploadSize' => KommaHelpers::fileUploadMaxSize()
]);
}
public function getModelTitle()
{
return __('KMS::kms/transfer.transfer');
}
}