File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Dynamic/ComponentType/Types/HeadingContent.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\OnOff;
use App\Komma\Kms\Core\Attributes\TextArea;
use App\Komma\Kms\Core\Attributes\TextField;
class HeadingContent extends AbstractComponentType
{
//Set an id that corresponds to the ComponentTypes enum
protected $id = ComponentTypes::HEADING_CONTENT;
//Set icon and name
protected $name = 'heading-content';
protected $translatableAttributes = ['title', 'description'];
public function __construct()
{
parent::__construct();
//Add attributes
$this->attributes->push((new OnOff())
->setLabelText('Grey Background')
->setStyleClass('is-background-option')
->mapValueFrom(Attribute::ValueFromItself, 'grey_background')
);
$this->attributes->push((new OnOff())
->setLabelText('Black Background')
->setStyleClass('is-background-option')
->mapValueFrom(Attribute::ValueFromItself, 'black_background')
);
$this->attributes->push((new TextField('title'))
->setPlaceholderText('Ex. Manage the whole rental cycle')
->mapValueFrom(Attribute::ValueFromItself, 'title'));
$this->attributes->push((new TextArea())
->enableTinymceEditorOnClick()
->setLabelText('text')
->setPlaceholderText('Ex. Lorum ipsum')
->mapValueFrom(Attribute::ValueFromItself, 'text')
);
$this->addButton();
$this->addButton('button-2');
}
}