File: D:/HostingSpaces/SBogers10/ste.komma.pro/app/Components/ComponentType/Types/NamedText.php
<?php
namespace App\Components\ComponentType\Types;
use App\Components\ComponentType\ComponentTypes;
use Komma\KMS\Core\Attributes\Attribute;
use Komma\KMS\Core\Attributes\OnOff;
use Komma\KMS\Core\Attributes\TextArea;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Users\Models\KmsUserRole;
class NamedText extends AbstractComponentType
{
public bool $adminOnly = true;
public function __construct()
{
//Set an id that corresponds to the ComponentTypes enum
$this->id = ComponentTypes::NAMED_TEXT;
//Set icon and name
$this->name = 'named-text';
parent::__construct();
$this->attributes->push((new TextField('Code Name'))
->setMinimumUserRole(KmsUserRole::SuperAdmin)
->mapValueFrom(Attribute::ValueFromComponent, 'code_name')
->setExplanation('Let op: Mag niet alleen een nummer zijn.')
);
$this->attributes->push((new TextArea())
->enableTinymceEditor()
->setLabelText(__('kms/attributes/components.text'))
->mapValueFrom(Attribute::ValueFromComponent, 'text')
);
}
}