File: D:/HostingSpaces/SBogers10/blije-gasten.komma.pro/app/Komma/Zipcodes/Kms/ZipcodeSection.php
<?php
/**
*
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\Komma\Zipcodes\Kms;
//The new object oriented attributes
use App\Komma\Components\ComponentType\ComponentTypes;
use App\Komma\Kms\Core\Attributes\Models\SelectOption;
use App\Komma\Kms\Core\Attributes\MultiSelect;
use App\Komma\Kms\Core\Attributes\ComponentArea;
use App\Komma\Kms\Core\Attributes\DatePicker;
use App\Komma\Kms\Core\Attributes\Documents;
use App\Komma\Kms\Core\Attributes\Select;
use App\Komma\Kms\Core\Sections\Section;
use App\Komma\Kms\Core\Attributes\Attribute;
use App\Komma\Kms\Core\Attributes\OnOff;
use App\Komma\Kms\Core\Attributes\Seperator;
use App\Komma\Kms\Core\Attributes\TextArea;
use App\Komma\Kms\Core\Attributes\TextField;
use App\Komma\Kms\Core\Attributes\Title;
use App\Komma\Kms\Core\Sections\Tabs\Collections\NoLanguageTabs;
use App\Komma\Kms\Core\ValidationSet;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
final class ZipcodeSection extends Section
{
/**
* ZipcodeSection constructor.
* @param $slug
*/
// function __construct(Kms $kms, PageRepository $repository)
function __construct($slug)
{
$tabs = new NoLanguageTabs();
parent::__construct($tabs, $slug);
}
/**
* Generates the attributes for this section. They all must extend the App\Komma\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
{
//*****************************************************************************************\\
//*** Generate the attributes ***\\
//*****************************************************************************************\\
$attributes = [];
//Build the general attributes and put them in the attributes array
$attributes[] = (new TextField(__('shop/zipcodes.zipcode')))
->mapValueFrom(Attribute::ValueFromModel, 'zipcode');
$attributes[] = (new TextField(__('shop/zipcodes.region_name')))
->mapValueFrom(Attribute::ValueFromModel, 'region_name');
$attributes[] = (new Select())
->setLabelText(__('shop/zipcodes.country'))
->setItems([
(new SelectOption())->setValue('BE')->setContent('Belgiƫ')->setHtmlContent('Belgiƫ'),
(new SelectOption())->setValue('NL')->setContent('Nederland')->setHtmlContent('Nederland'),
])
->mapValueFrom(Attribute::ValueFromModel, 'country');
$attributes[] = (new TextField(__('shop/zipcodes.price')))
->mapValueFrom(Attribute::ValueFromModel, 'price');
//Return all attributes as a collection
return collect(array_merge($attributes));
}
/**
* This method will stop the load entities of the kmsSiteSection
*
* @return array
*
*/
public function loadEntities(){
return [];
}
}