HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Services/Kms/ServiceSection.php
<?php


namespace App\Services\Kms;

use App\Buttons\Kms\ButtonService;
use App\Components\ComponentTypes;
use App\Services\Models\Service;
use Illuminate\Database\Eloquent\Model;
use Komma\KMS\Core\Attributes\ComponentArea;
use Komma\KMS\Core\Attributes\Models\ImageProperty;
use Komma\KMS\Core\Attributes\Models\SelectOption;
use Komma\KMS\Core\Attributes\MultiSelect;
use Komma\KMS\Core\Attributes\Documents;
use Komma\KMS\Core\Attributes\OnOff;
use Komma\KMS\Core\Attributes\Select;
use Komma\KMS\Core\Attributes\Seperator;
use Komma\KMS\Core\Attributes\TextArea;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Core\Attributes\Title;
use Komma\KMS\Core\Sections\Section;
use App\Servicepoints\Kms\ServicepointService;
use Komma\KMS\Users\Models\KmsUserRole;

final class ServiceSection extends Section
{
    public function defineAttributesAndTabs(Model $currentModel = null): void
    {

        $serviceTypeOptions = [];
        foreach (Service::$serviceType as $key => $serviceType) {
            $serviceTypeOptions[] = (new SelectOption())
                ->setValue($key)
                ->setHtmlContent(__('KMS::services.' . $serviceType))
                ->setContent(__('KMS::services.' . $serviceType));
        }

        $heroShape = [];
        for($i = 1; $i <= 2; $i++) $heroShape[] = (new SelectOption())->setValue($i)->setContent($i)->setHtmlContent($i);
        $heroShape[] = (new SelectOption())->setValue(0)->setContent('Geen')->setHtmlContent('Geen');

        $heroBottomShape = [];
        for($i = 1; $i <= 2; $i++) $heroBottomShape[] = (new SelectOption())->setValue($i)->setContent($i)->setHtmlContent($i);
        $heroBottomShape[] = (new SelectOption())->setValue(0)->setContent('Geen')->setHtmlContent('Geen');

        $this->tabs->makeTab()->addItems([
            (new OnOff())
                ->setReference('active')
                ->setLabelText(__('KMS::global.active'))
                ->switchOn(),

            (new TextField())
                ->setReference('icon_name')
                ->setMinimumUserRole(KmsUserRole::SuperAdmin)
                ->setLabelText('Icon key'),

            (new Select())
                ->setReference('service_type')
                ->setLabelText('Soort')
                ->setItems($serviceTypeOptions),

            (new Seperator())
                ->setMinimumUserRole(KmsUserRole::SuperAdmin),

            (new Title())->setLabelText('Hero / Heading')
                ->setMinimumUserRole(KmsUserRole::SuperAdmin),

            (new Documents())
                ->setReference('service_heading')
                ->setLabelText(__('KMS::global.index_image'))
                ->onlyAllowImages()
                ->setSmallDragAndDropArea()
                ->setMaxDocuments(1)
                ->setSubFolder('service_heading'),

            (new Select())
                ->setItems(ComponentTypes::shapeOptions())
                ->setLabelText('Afbeelding vorm')
                ->setReference('hero_image_shape')
                ->setMinimumUserRole(KmsUserRole::SuperAdmin),

//            (new Select())
//                ->setItems($heroShape)
//                ->setLabelText('Hero hoek vorm')
//                ->setReference('hero_shape')
//                ->setMinimumUserRole(KmsUserRole::SuperAdmin),
//
//            (new Select())
//                ->setItems($heroBottomShape)
//                ->setLabelText('Hero onderkant vorm')
//                ->setReference('hero_bottom_shape')
//                ->setMinimumUserRole(KmsUserRole::SuperAdmin),
        ]);

        $this->tabs->makeLanguageTabTemplate()->addItems([
            (new TextField())
                ->setReference('name')
                ->setLabelText(__('KMS::global.title')),

            (new TextField())
                ->setReference('visual_name')
                ->setLabelText('Visual name')
                ->setExplanation('Ter vervangen van de normale naam'),

            (new TextField())
                ->setLabelText('Teaser')
                ->setReference('description'),

            (new Seperator()),

            (new Title())->setLabelText('SEO'),

            (new TextField())
                ->setReference('meta_title')
                ->setLabelText(__('KMS::global.metaTitle')),

            (new TextArea())
                ->setLabelText(__('KMS::global.metaDescription'))
                ->setReference('meta_description'),

            (new Seperator()),

            (new Title())->setLabelText('Heading'),

            (new TextArea())
                ->setLabelText('Omschrijving')
                ->setReference('hero_description')
                ->setStyleFormatFromConfig()
                ->enableTinymceEditor(),

            (new TextField())
                ->setReference('button_text')
                ->setLabelText('Button'),

            (new TextField())
                ->setReference('button_link')
                ->setLabelText('Link'),

            (new ComponentArea())
                ->setReference('service_components')
                ->setSubFolder('service_component_data')
                ->setComponentTypes(ComponentTypes::getPageComponents())
        ]);

    }
}