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/SBogers10/rentman2019.komma.pro/app/Komma/Dynamic/ComponentType/Types/Capterra.php
<?php

namespace App\Komma\Dynamic\ComponentType\Types;

use App\Komma\Dynamic\ComponentType\ComponentTypes;
use App\Komma\Kms\Core\Attributes\Attribute;
use App\Komma\Kms\Core\Attributes\Models\SelectOption;
use App\Komma\Kms\Core\Attributes\Select;

class Capterra extends AbstractComponentType
{
    //Set an id that corresponds to the ComponentTypes enum
    protected $id = ComponentTypes::CAPTERRA;

    //Set icon and name
    protected $name = 'capterra';

    protected $hasTranslatables = false;

    public function __construct()
    {
        parent::__construct();

        $backgroundOptions = collect([
            (new SelectOption())->setValue(0)->setContent('None')->setHtmlContent('None'),
            (new SelectOption())->setValue(1)->setContent('Grey')->setHtmlContent('Grey'),
            (new SelectOption())->setValue(2)->setContent('Black')->setHtmlContent('Black'),
        ]);

        $spacingOptions = collect([
            (new SelectOption())->setValue(0)->setContent('None')->setHtmlContent('None'),
            (new SelectOption())->setValue(1)->setContent('Top')->setHtmlContent('Top'),
            (new SelectOption())->setValue(2)->setContent('Bottom')->setHtmlContent('Bottom'),
            (new SelectOption())->setValue(3)->setContent('Both')->setHtmlContent('Both'),
        ]);

        $this->attributes->push((new Select())
            ->setLabelText('Top Background')
            ->setStyleClass('is-background-option')
            ->setItems($backgroundOptions->toArray())
            ->mapValueFrom(Attribute::ValueFromItself, 'top_background')
        );

        $this->attributes->push((new Select())
            ->setLabelText('Bottom Background')
            ->setStyleClass('is-background-option')
            ->setItems($backgroundOptions->toArray())
            ->mapValueFrom(Attribute::ValueFromItself, 'bottom_background')
        );

        $this->attributes->push((new Select())
            ->setLabelText('Spacing ')
            ->setStyleClass('is-background-option')
            ->setItems($spacingOptions->toArray())
            ->mapValueFrom(Attribute::ValueFromItself, 'spacing')
        );
    }
}