File: D:/HostingSpaces/blijegasten/blijegasten.be/app/Komma/Components/ComponentType/Types/LogoSlider.php
<?php
namespace App\Komma\Components\ComponentType\Types;
use App\Komma\Components\ComponentType\ComponentTypes;
use App\Komma\Kms\Core\Attributes\Attribute;
use App\Komma\Kms\Core\Attributes\Documents;
use App\Komma\Kms\Core\Attributes\Models\ImageProperty;
use App\Komma\Kms\Core\Attributes\TextField;
class LogoSlider extends AbstractComponentType
{
public function __construct()
{
//Set an id that corresponds to the ComponentTypes enum
$this->id = ComponentTypes::LOGO_SLIDER;
//Set icon and name
$this->name = 'testimonial';
parent::__construct();
$this->attributes->push((new TextField('Titel'))
->mapValueFrom(Attribute::ValueFromComponent, 'name')
);
$this->attributes->push((new Documents())
->onlyAllowImages()
->setSubFolder('component_uploads')
->setMaxDocuments(7)
->setImageProperties([
(new ImageProperty())->setName('large')->setCropMethod(ImageProperty::Resize)->setWidth(900),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(740),
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Resize)->setWidth(375),
])
->setSmallDragAndDropArea()
->mapValueFrom(Attribute::ValueFromComponent, 'logos') //Needed to sustain Attribute integrity. -
);
}
}