File: D:/HostingSpaces/SBogers10/ste.komma.pro/app/Components/ComponentType/Types/References.php
<?php
namespace App\Components\ComponentType\Types;
use App\Components\ComponentType\ComponentTypes;
use Komma\KMS\Core\Attributes\Attribute;
use Komma\KMS\Core\Attributes\Documents;
use Komma\KMS\Core\Attributes\Models\ImageProperty;
use Komma\KMS\Core\Attributes\OnOff;
use Komma\KMS\Core\Attributes\Seperator;
use Komma\KMS\Core\Attributes\TextArea;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Core\Attributes\Title;
use Komma\KMS\Users\Models\KmsUserRole;
class References extends AbstractComponentType
{
public function __construct()
{
//Set an id that corresponds to the ComponentTypes enum
$this->id = ComponentTypes::REFERENCES;
//Set icon and name
$this->name = 'references';
parent::__construct();
$this->attributes->push((new TextField('Titel'))
->mapValueFrom(Attribute::ValueFromComponent, 'name')
);
$this->attributes->push((new OnOff())
->setLabelText('Titel vanuit midden uitlijnen')
->mapValueFrom(Attribute::ValueFromComponent, 'alignCenter')
);
$this->attributes->push(new Seperator());
$this->attributes->push((new Documents())
->onlyAllowImages()
->setSubFolder('component_uploads_references')
->setMaxDocuments(80)
->setImageProperties([
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Resize)->setWidth(200),
])
->mapValueFrom(Attribute::ValueFromComponent, 'partners') //Needed to sustain Attribute integrity.
);
}
}