File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Dynamic/ComponentType/Types/ImageTextSteps.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\Documents;
use App\Komma\Kms\Core\Attributes\OnOff;
use App\Komma\Kms\Core\Attributes\TextArea;
use App\Komma\Kms\Core\Attributes\TextField;
class ImageTextSteps extends AbstractComponentType
{
public function __construct()
{
//Set an id that corresponds to the ComponentTypes enum
$this->id = ComponentTypes::IMAGE_TEXT_STEPS;
//Set icon and name
$this->name = 'image-text-steps';
parent::__construct();
$this->attributes->push((new OnOff())
->setLabelText('Grey Background')
->setStyleClass('is-background-option')
->mapValueFrom(Attribute::ValueFromItself, 'grey_background'));
$this->attributes->push((new TextField('Title'))
->setPlaceholderText('Title')
->mapValueFrom(Attribute::ValueFromItself, 'slider_title'));
$this->attributes->push((new TextField('Label'))
->setPlaceholderText('Label')
->mapValueFrom(Attribute::ValueFromItself, 'slider_label'));
for ($i = 0; $i < 3; $i++) {
$this->translatableAttributes[] = 'title_'.($i + 1);
$this->translatableAttributes[] = 'description_'.($i + 1);
$this->translatableAttributes[] = 'button_'.($i + 1).'_label';
$this->attributes->push((new TextField('Tab'))
->mapValueFrom(Attribute::ValueFromItself, 'title_'.($i + 1))//Needed to sustain Attribute integrity.
->setPlaceholderText('Ex. Av & Lighting')
->setDataAttribute('tab', ($i + 1))
);
$this->attributes->push((new Documents())
->setLabelText('Impression')
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setSubFolder('customerStoryImpression')
->mapValueFrom(Attribute::ValueFromItself, 'impression_'.($i + 1)) //Needed to sustain Attribute integrity.
->setDataAttribute('tab', ($i + 1)));
$this->attributes->push((new TextArea())
->setLabelText('Description')
->setPlaceholderText('Ex. Lorum ipsum')
->enableTinymceEditorOnClick()
->mapValueFrom(Attribute::ValueFromItself, 'description_'.($i + 1))//Needed to sustain Attribute integrity.
->setDataAttribute('tab', ($i + 1)));
$this->attributes->push((new OnOff())
->setLabelText('Reverse')
->mapValueFrom(Attribute::ValueFromItself, 'reversed_'.($i + 1))
->setDataAttribute('tab', ($i + 1)));
$this->attributes->push((new OnOff())
->setLabelText('Filled button')
->mapValueFrom(Attribute::ValueFromItself, 'filled_button_'.($i + 1))
->setDataAttribute('tab', ($i + 1)));
$this->addButton('Button '.($i + 1), ($i + 1));
}
}
}