File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Components/Types/TextImageButton.php
<?php
namespace App\Components\Types;
use App\Components\ComponentTypes;
use Komma\KMS\Components\ComponentType\Types\AbstractComponentType;
use Komma\KMS\Core\Attributes\Documents;
use Komma\KMS\Core\Attributes\Models\ImageProperty;
use Komma\KMS\Core\Attributes\Models\SelectOption;
use Komma\KMS\Core\Attributes\OnOff;
use Komma\KMS\Core\Attributes\Select;
use Komma\KMS\Core\Attributes\Seperator;
use Komma\KMS\Core\Attributes\TextArea;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Core\Attributes\Title;
class TextImageButton extends AbstractComponentType
{
protected int $id = ComponentTypes::TEXT_IMAGE_BUTTON;
protected string $name = 'text-image';
public function defineAttributesAndTabs()
{
$this->addItems([
(new TextArea())
->setReference('text')
->enableTinymceEditor(),
(new TextField())
->setReference('button')
->setLabelText('Button'),
(new TextField())
->setReference('link')
->setLabelText('Link'),
(new Seperator()),
(new Documents())
->setReference('image')
->onlyAllowImages()
->setSubFolder('component_uploads')
->setMaxDocuments(1)
->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(),
(new Seperator()),
(new Title())
->setLabelText(__('KMS::attributes/components.options')),
(new OnOff())
->setReference('reversed')
->setLabelText(__('KMS::attributes/components.swap_text_image')),
(new Select())
->setItems(ComponentTypes::shapeOptions())
->setLabelText('Vorm')
->setReference('shape'),
]);
}
}