HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/helder.komma.pro/app/Komma/Components/ComponentType/Types/Snippet.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\CodeSnippet;
use App\Komma\Kms\Core\Attributes\TextField;

class Snippet extends AbstractComponentType
{
    public function __construct()
    {
        //Set an id that corresponds to the ComponentTypes enum
        $this->id = ComponentTypes::SNIPPET;

        //Set icon and name
        $this->name = 'snippet';

        parent::__construct();

        $bladeFilePathFormat = 'resources/views/site/{value}.blade.php';
        $scssFilePathFormat = 'resources/assets/sass/site/{value}.scss';

        $this->attributes->push((new TextField('Modifiers'))
            ->setPlaceholderText(__('kms/global.modifiers'))
            ->mapValueFrom(Attribute::ValueFromItself, 'modifiers')
        );

        $this->attributes->push((new CodeSnippet('Blade file'))
            ->setPlaceholderText(__('kms/global.blade'))
            ->setExplanation('format: '. $bladeFilePathFormat)
            ->setFilePathFormat($bladeFilePathFormat)
            ->mapValueFrom(Attribute::ValueFromItself, 'blade')
        );

        $this->attributes->push((new CodeSnippet('SCSS file'))
            ->setPlaceholderText(__('kms/global.scss'))
            ->setExplanation('format: ' . $scssFilePathFormat)
            ->setFilePathFormat($scssFilePathFormat)
            ->mapValueFrom(Attribute::ValueFromItself, 'scss')
        );
    }
}