File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Properties/Kms/PropertyKeySection.php
<?php
namespace App\Properties\Kms;
use Illuminate\Database\Eloquent\Model;
use Komma\KMS\Core\Attributes\Attribute;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Core\Sections\Section;
use Komma\KMS\Globalization\Languages\Models\Language;
use Komma\KMS\Sites\Kms\SiteService;
class PropertyKeySection extends Section
{
/**
* Define the attributes and tabs for this section.
*
* @param Model $currentModel
*/
public function defineAttributesAndTabs(Model $currentModel = null): void
{
$siteService = new SiteService();
$items = $siteService->languagesHavingSites()->get()->map(function(Language $language) {
return [
(new TextField())
->setLabelText(__('KMS::properties.property').' '.$language->iso_2.'')
->setExplanation(__('KMS::properties.key_explanation'))
->setEntity(Attribute::ValueFromItself)
->setReference('key')
->setAssociatedLanguage($language)
];
})->collapse()->toArray();
$this->tabs->makeTab(__('KMS::properties.properties'))->addItems($items);
}
}