File: D:/HostingSpaces/SBogers95/rentman.io/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')
);
}
}