HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Dynamic/ComponentType/Types/StorySlider.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 StorySlider extends AbstractComponentType
{
    public function __construct()
    {
        parent::__construct();

        //Set an id that corresponds to the ComponentTypes enum
        $this->id = ComponentTypes::STORY_SLIDER;

        //Set icon and name
        $this->name = 'story-slider';
        $this->icon = 'customer-story-slider';

        $this->attributes->push((new OnOff())
            ->setLabelText('Grey Background')
            ->setStyleClass('is-background-option')
            ->mapValueFrom(Attribute::ValueFromItself, 'grey_background'));

        for ($i = 0; $i < 6; $i++) {
            $this->attributes->push((new TextField('Person'))
                ->mapValueFrom(Attribute::ValueFromItself, 'person_'.($i + 1))//Needed to sustain Attribute integrity.
                ->setPlaceholderText('Ex. Roy van den Broek')
                ->setDataAttribute('tab', ($i + 1)));

            $this->attributes->push((new TextField('Function'))
                ->mapValueFrom(Attribute::ValueFromItself, 'function_'.($i + 1))//Needed to sustain Attribute integrity.
                ->setPlaceholderText('Ex. SEO')
                ->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 Documents())
                ->setLabelText('Image')
                ->onlyAllowImages()
                ->setSmallDragAndDropArea()
                ->setMaxDocuments(1)
                ->setSubFolder('customerStoryImpression')
                ->mapValueFrom(Attribute::ValueFromItself, 'image_'.($i + 1)) //Needed to sustain Attribute integrity.
                ->setDataAttribute('tab', ($i + 1)));
        }
    }
}