File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Komma/Components/ComponentLibrary.php
<?php
/**
* Created by PhpStorm.
* User: mikevandersanden
* Date: 16/01/2019
* Time: 19:39
*/
namespace App\Komma\Components;
use App\Komma\Dynamic\ComponentType\ComponentTypeBuilder;
use App\Komma\Kms\Core\Attributes\Attribute;
use App\Komma\Kms\Core\Attributes\AutocompleteInput;
use App\Komma\Kms\Core\Attributes\Documents;
use App\Komma\Kms\Core\Attributes\Models\ImageProperty;
use App\Komma\Kms\Core\Attributes\Models\SelectOption;
use App\Komma\Kms\Core\Attributes\OnOff;
use App\Komma\Kms\Core\Attributes\Select;
use App\Komma\Kms\Core\Attributes\TextArea;
use App\Komma\Kms\Core\Attributes\TextField;
use App\Komma\References\Models\Reference;
use App\Komma\References\Kms\ReferenceService;
use App\Komma\Services\Kms\ServiceService;
use App\Komma\Services\Models\Service;
use App\Komma\Users\Kms\UserService;
class ComponentLibrary
{
/**
* @var ComponentTypeBuilder
*/
private $componentTypeBuilder;
/**
* ComponentLibrary constructor.
* @param ComponentTypeBuilder $componentTypeBuilder
*/
public function __construct(ComponentTypeBuilder $componentTypeBuilder)
{
$this->componentTypeBuilder = $componentTypeBuilder;
}
/**
* Find a method in the library by name
*
* @param $name
* @return bool
*/
public function find($name)
{
// Convert name to camel case
$methodName = camel_case($name);
// Check if such a method exists in library
if (!method_exists($this, $methodName)) {
return false;
}
return $this->{$methodName}();
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function singleText()
{
return $this->componentTypeBuilder
->setName('single-text')
->setIcon('dynamic-text-text.svg')
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Content')
->mapValueFrom(Attribute::ValueFromItself, 'content') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function doubleText()
{
return $this->componentTypeBuilder
->setName('double-text')
->setIcon('dynamic-text-text.svg')
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Content left')
->mapValueFrom(Attribute::ValueFromItself, 'content_left') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Content right')
->mapValueFrom(Attribute::ValueFromItself, 'content_right') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function singleImage()
{
return $this->componentTypeBuilder
->setName('single-image')
->setIcon('dynamic-text-image.svg')
->addAttribute(
(new Documents())
->setLabelText('Image')
->onlyAllowImages()
->setMaxDocuments(5)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(2000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Resize)->setWidth(300),
])
->mapValueFrom(Attribute::ValueFromItself, 'image') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function fullWidthImage()
{
return $this->componentTypeBuilder
->setName('full-width-image')
->setIcon('dynamic-text-image.svg')
->addAttribute(
(new Documents())
->setLabelText('Image')
->onlyAllowImages()
->setMaxDocuments(5)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(2000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Resize)->setWidth(300),
])
->mapValueFrom(Attribute::ValueFromItself, 'image') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function textImage()
{
return $this->componentTypeBuilder
->setName('text-image')
->setIcon('dynamic-text-image.svg')
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Tekst')
->mapValueFrom(Attribute::ValueFromItself, 'content') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Documents())
->setLabelText('Plaatje')
->onlyAllowImages()
->setMaxDocuments(5)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(2000),
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Resize)->setWidth(300),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'image') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function snippet()
{
$bladeFilePathFormat = 'resources/views/site/{value}.blade.php';
$scssFilePathFormat = 'resources/assets/sass/site/{value}.scss';
return $this->componentTypeBuilder
->setName('snippet')
->setIcon('snippet.svg')
->addAttribute(
(new TextField('Modifiers'))
->setPlaceholderText(__('kms/global.modifiers'))
->mapValueFrom(Attribute::ValueFromItself, 'modifiers')
)
->addAttribute(
(new CodeSnippet('Blade file'))
->setPlaceholderText(__('kms/global.blade'))
->setExplanation('format: ' . $bladeFilePathFormat)
->setFilePathFormat($bladeFilePathFormat)
->mapValueFrom(Attribute::ValueFromItself, 'blade')
)
->addAttribute(
(new CodeSnippet('SCSS file'))
->setPlaceholderText(__('kms/global.scss'))
->setExplanation('format: ' . $scssFilePathFormat)
->setFilePathFormat($scssFilePathFormat)
->mapValueFrom(Attribute::ValueFromItself, 'scss')
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function hierarchy()
{
return $this->componentTypeBuilder
->setName('hierarchy')
->setIcon('hierarchy.svg')
->addAttribute(
(new TextField('Hierarchy'))
->setPlaceholderText(__('kms/global.hierarchy'))
->mapValueFrom(Attribute::ValueFromItself, 'hierarchy') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function headerStreamer()
{
return $this->componentTypeBuilder
->setName('headerStreamer')
->setIcon('headerStreamer.svg')
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Tekst')
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->onlyAllowImages()
->setMaxDocuments(5)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Select())
->setItems([
(new SelectOption())->setValue(1)->setContent(1)->setHtmlContent(1),
(new SelectOption())->setValue(6)->setContent(6)->setHtmlContent(6),
(new SelectOption())->setValue(7)->setContent(7)->setHtmlContent(7),
])
->setLabelText(__('Vorm'))
->mapValueFrom(Attribute::ValueFromItself, 'Path')
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function servicesRow()
{
return $this->componentTypeBuilder
->setName('servicesRow')
->setIcon('servicesRow.svg');
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function referencesRow()
{
return $this->componentTypeBuilder
->linkableToModel(Reference::class, ReferenceService::class . '@getOptionsForSelect')
->setName('referencesRow')
->setIcon('referencesRow.svg');
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function bigQuote()
{
return $this->componentTypeBuilder
->setName('bigQuote')
->setIcon('bigQuote.svg')
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Tekst')
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Person name'))
->setPlaceholderText(__('kms/global.name'))
->mapValueFrom(Attribute::ValueFromItself,
'name') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Job Title'))
->setPlaceholderText(__('kms/global.jobTitle'))
->mapValueFrom(Attribute::ValueFromItself,
'jobTitle') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->onlyAllowImages()
->setSubFolder('component_documents')
->setMaxDocuments(5)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function ctaPerson()
{
return $this->componentTypeBuilder
->setName('ctaPerson')
->setIcon('ctaPerson.svg')
->addAttribute(
(new TextField('Text'))
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->onlyAllowImages()
->setSubFolder('component_documents')
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Person name'))
->setPlaceholderText(__('kms/global.name'))
->mapValueFrom(Attribute::ValueFromItself,
'name') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Job Title'))
->setPlaceholderText(__('kms/global.jobTitle'))
->mapValueFrom(Attribute::ValueFromItself,
'jobTitle') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Phone number'))
->setPlaceholderText(__('kms/global.phone'))
->mapValueFrom(Attribute::ValueFromItself,
'phone') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function ctaBlock()
{
return $this->componentTypeBuilder
->setName('ctaBlock')
->setIcon('ctaBlock.svg')
->addAttribute(
(new TextField('Text'))
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Blok Title'))
->setPlaceholderText(__('kms/global.blockTitle'))
->mapValueFrom(Attribute::ValueFromItself,
'blockTitle') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Blok text')
->setPlaceholderText(__('kms/global.blockText'))
->mapValueFrom(Attribute::ValueFromItself,
'blockText') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function servicesCtaBlock()
{
return $this->componentTypeBuilder
->setName('servicesCtaBlock')
->setIcon('servicesCtaBlock.svg')
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->onlyAllowImages()
->setSubFolder('component_documents')
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Person name'))
->setPlaceholderText(__('kms/global.name'))
->mapValueFrom(Attribute::ValueFromItself,
'name') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Job Title'))
->setPlaceholderText(__('kms/global.jobTitle'))
->mapValueFrom(Attribute::ValueFromItself,
'jobTitle') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Person Tekst')
->mapValueFrom(Attribute::ValueFromItself, 'personText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Text'))
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function extendedContentBlock()
{
return $this->componentTypeBuilder
->setName('extendedContentBlock')
->setIcon('extendedContentBlock.svg')
->addAttribute(
(new TextField('Step'))
->setPlaceholderText('Stap (voor werkwijze blokken)')
->mapValueFrom(Attribute::ValueFromItself,
'Step') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->enableTinymceEditor()
->setLabelText('Tekst')
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->onlyAllowImages()
->setMaxDocuments(5)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image') //Needed to sustain Attribute integrity.
)
->addAttribute((new OnOff())
->setLabelText('Afbeelding rechts?')
->mapValueFrom(Attribute::ValueFromItself, 'ImagePosition')
)
->addAttribute(
(new Select())
->setItems([
(new SelectOption())->setValue(1)->setContent(1)->setHtmlContent(1),
(new SelectOption())->setValue(13)->setContent(13)->setHtmlContent(13),
(new SelectOption())->setValue(14)->setContent(14)->setHtmlContent(14),
(new SelectOption())->setValue(15)->setContent(15)->setHtmlContent(15),
(new SelectOption())->setValue(16)->setContent(16)->setHtmlContent(16),
])
->setLabelText(__('Vorm'))
->mapValueFrom(Attribute::ValueFromItself, 'Path')
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function employeesRow()
{
$userModels = (new UserService)->getOptionsForSelect();
return $this->componentTypeBuilder
->setName('employeesRow')
->setIcon('employeesRow.svg')
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextArea())
->setLabelText('Text')
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function methodsRow()
{
return $this->componentTypeBuilder
->setName('methodsRow')
->setIcon('methodsRow.svg')
->addAttribute(
(new TextField('Titel'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself, 'Title') //Needed to sustain Attribute integrity.
)
// first tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Stap 1')
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_1')
)
->addAttribute(
(new TextArea())
->setLabelText('Text')
->setPlaceholderText(__('kms/global.Text'))
->enableTinymceEditor()
->setDataAttribute('tab', 'Stap 1')
->mapValueFrom(Attribute::ValueFromItself, 'text_1') //Needed to sustain Attribute integrity.
)
// second tab
->addAttribute(
(new Documents())
->setLabelText('Icoon')
->setDataAttribute('tab', 'Stap 2')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_2')
)
->addAttribute(
(new TextArea())
->setLabelText('Text')
->setPlaceholderText(__('kms/global.Text'))
->enableTinymceEditor()
->setDataAttribute('tab', 'Stap 2')
->mapValueFrom(Attribute::ValueFromItself, 'text_2') //Needed to sustain Attribute integrity.
)
// second tab
->addAttribute(
(new Documents())
->setLabelText('Icoon')
->setDataAttribute('tab', 'Stap 3')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_3')
)
->addAttribute(
(new TextArea())
->setLabelText('Text')
->setPlaceholderText(__('kms/global.Text'))
->enableTinymceEditor()
->setDataAttribute('tab', 'Stap 3')
->mapValueFrom(Attribute::ValueFromItself, 'text_3') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function partnersRow()
{
return $this->componentTypeBuilder
->setName('partnersRow')
->setIcon('partnersRow.svg')
->addAttribute(
(new TextField('Titel'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself, 'Title') //Needed to sustain Attribute integrity.
)
// first tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Partner 1')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_1')
)
->addAttribute(
(new TextField('Bedrijfsnaam'))
->setPlaceholderText(__('kms/global.title'))
->setDataAttribute('tab', 'Partner 1')
->mapValueFrom(Attribute::ValueFromItself, 'Company_1') //Needed to sustain Attribute integrity.
)
// second tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Partner 2')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_2')
)
->addAttribute(
(new TextField('Bedrijfsnaam'))
->setPlaceholderText(__('kms/global.title'))
->setDataAttribute('tab', 'Partner 2')
->mapValueFrom(Attribute::ValueFromItself, 'Company_2') //Needed to sustain Attribute integrity.
)
// third tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Partner 3')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_3')
)
->addAttribute(
(new TextField('Bedrijfsnaam'))
->setPlaceholderText(__('kms/global.title'))
->setDataAttribute('tab', 'Partner 3')
->mapValueFrom(Attribute::ValueFromItself, 'Company_3') //Needed to sustain Attribute integrity.
)
// fourth tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Partner 4')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_4')
)
->addAttribute(
(new TextField('Bedrijfsnaam'))
->setPlaceholderText(__('kms/global.title'))
->setDataAttribute('tab', 'Partner 4')
->mapValueFrom(Attribute::ValueFromItself, 'Company_4') //Needed to sustain Attribute integrity.
)
// fifth tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Partner 5')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_5')
)
->addAttribute(
(new TextField('Bedrijfsnaam'))
->setPlaceholderText(__('kms/global.title'))
->setDataAttribute('tab', 'Partner 5')
->mapValueFrom(Attribute::ValueFromItself, 'Company_5') //Needed to sustain Attribute integrity.
)
// sixth tab
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->setDataAttribute('tab', 'Partner 6')
->onlyAllowImages()
->setSubFolder('component_documents')
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image_6')
)
->addAttribute(
(new TextField('Bedrijfsnaam'))
->setPlaceholderText(__('kms/global.title'))
->setDataAttribute('tab', 'Partner 6')
->mapValueFrom(Attribute::ValueFromItself, 'Company_6') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function referencesView()
{
return $this->componentTypeBuilder
->setName('referencesView')
->setIcon('referencesView.svg')
->addAttribute(
(new TextField('Text'))
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function contactContent()
{
return $this->componentTypeBuilder
->setName('contactContent')
->setIcon('contactContent.svg')
->addAttribute(
(new TextField('Bedankt tekst'))
->setPlaceholderText('Bedankt voor uw bericht, wij nemen zo snel mogelijk contact met u op.')
->mapValueFrom(Attribute::ValueFromItself, 'ThanksText') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function adviceContent()
{
return $this->componentTypeBuilder
->setName('adviceContent')
->setIcon('adviceContent.svg')
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Text'))
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new Documents())
->setLabelText('Afbeelding')
->onlyAllowImages()
->setMaxDocuments(1)
->setSubFolder('component_documents')
->setImageProperties([
(new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1000),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(800),
])
->mapValueFrom(Attribute::ValueFromItself, 'Image') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Bedankt tekst'))
->setPlaceholderText('Bedankt voor uw aanvraag, wij nemen zo snel mogelijk contact met u op.')
->mapValueFrom(Attribute::ValueFromItself, 'ThanksText') //Needed to sustain Attribute integrity.
);
}
/**
* @return \App\Komma\Dynamic\ComponentType\AbstractComponentTypeBuilder
*/
public function ctaText()
{
return $this->componentTypeBuilder
->setName('ctaText')
->setIcon('ctaText.svg')
->addAttribute(
(new TextField('Text'))
->setPlaceholderText(__('kms/global.text'))
->mapValueFrom(Attribute::ValueFromItself, 'Text') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Title'))
->setPlaceholderText(__('kms/global.title'))
->mapValueFrom(Attribute::ValueFromItself,
'Title') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Tekst'))
->setPlaceholderText(__('kms/global.linkText'))
->mapValueFrom(Attribute::ValueFromItself,
'linkText') //Needed to sustain Attribute integrity.
)
->addAttribute(
(new TextField('Link Adres'))
->setPlaceholderText(__('kms/global.linkAddress'))
->mapValueFrom(Attribute::ValueFromItself,
'linkAddress') //Needed to sustain Attribute integrity.
);
}
}