File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Dynamic/ComponentType/Types/DoubleText.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;
class DoubleText extends AbstractComponentType
{
//Set an id that corresponds to the ComponentTypes enum
protected $id = ComponentTypes::DOUBLE_TEXT;
//Set icon and name
protected $name = 'double-text';
protected $translatableAttributes = ['left', 'right'];
public function __construct()
{
parent::__construct();
$this->attributes->push((new OnOff())
->setLabelText('Grey Background')
->setStyleClass('is-background-option')
->mapValueFrom(Attribute::ValueFromItself, 'grey_background')
);
$this->attributes->push((new TextArea())
->enableTinymceEditorOnClick()
->setLabelText('left')
->setPlaceholderText('Ex. Lorum ipsum')
->mapValueFrom(Attribute::ValueFromItself, 'left') //Needed to sustain Attribute integrity.
);
$this->attributes->push((new OnOff())
->setLabelText('Left block in card view?')
->setStyleClass('is-card-left')
->mapValueFrom(Attribute::ValueFromItself, 'is_card_left')
);
$this->attributes->push((new TextArea())
->enableTinymceEditorOnClick()
->setLabelText('right')
->setPlaceholderText('Ex. Lorum ipsum')
->mapValueFrom(Attribute::ValueFromItself, 'right') //Needed to sustain Attribute integrity.
);
$this->attributes->push((new OnOff())
->setLabelText('Right block in card view?')
->setStyleClass('is-card-right')
->mapValueFrom(Attribute::ValueFromItself, 'is_card_right')
);
$this->addButton('Button 1');
$this->addButton('Button 2');
}
}