File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Dynamic/ComponentType/Types/AccordionTextarea.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\Seperator;
use App\Komma\Kms\Core\Attributes\TextArea;
use App\Komma\Kms\Core\Attributes\TextField;
class AccordionTextarea extends AbstractComponentType
{
//Set an id that corresponds to the ComponentTypes enum
protected $id = ComponentTypes::ACCORDION_TEXTAREA;
//Set icon and name
protected $name = 'accordion-textarea';
protected $translatableAttributes = ['title', 'button_label'];
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 OnOff())
->setLabelText('Black Background')
->setStyleClass('is-background-option')
->mapValueFrom(Attribute::ValueFromItself, 'black_background')
);
$this->attributes->push((new TextArea())
->enableTinymceEditorOnClick()
->setLabelText('text')
->setPlaceholderText('Ex. Lorum ipsum')
->mapValueFrom(Attribute::ValueFromItself, 'text')
);
$this->addButton('Global Button');
for ($i = 0; $i < 4; $i++) {
$this->translatableAttributes[] = 'title_'.($i + 1);
$this->translatableAttributes[] = 'description_'.($i + 1);
$this->translatableAttributes[] = 'button_'.($i + 1).'_label';
$this->attributes->push((new TextField('Title'))
->mapValueFrom(Attribute::ValueFromItself, 'title_'.($i + 1))//Needed to sustain Attribute integrity.
->setPlaceholderText('Ex. Improve team collaboration')
->setDataAttribute('tab', ($i + 1)));
$this->attributes->push((new TextArea())
->setLabelText('Description')
->setPlaceholderText('Ex. Lorum ipsum')
->mapValueFrom(Attribute::ValueFromItself, 'description_'.($i + 1))//Needed to sustain Attribute integrity.
->setDataAttribute('tab', ($i + 1)));
$this->attributes->push((new Seperator())
->setDataAttribute('tab', ($i + 1)));
$this->addButton('Button '.($i + 1), ($i + 1));
}
$this->attributes->push((new OnOff())
->setLabelText('Reverse')
->mapValueFrom(Attribute::ValueFromItself, 'reversed')
);
}
}