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/SBogers26/gripp.nu/workbench/komma/kms/src/Komma/Kms/NewsItems/NewsItemSection.php
<?php
/**
 * Short description for the file.
 *
 * @author      Komma <info@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

namespace Komma\Kms\NewsItems;

use Komma\Kms\NewsItems\Models\NewsItem;
use Komma\Kms\Core\Kms;
use Komma\Kms\Core\Sections\KmsSectionTabs;
use Komma\Kms\Core\Sections\KmsSection;

class NewsItemSection extends KmsSection
{
    protected $title = "Pagina&rsquo;s";
    protected $subTitle = "";
    protected $slug = "newsitems";

    //public $showDelete = false;
    //public $showCreate = false;

    protected $entityAttributesData = [
        // NewsItems Attributes


        'name' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsTextField',
            'tab' => 'Pagina',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Titel',
                'placeholder' => 'Kies een passende titel voor het pagina',
                'validation' => [
                    'rules' => 'required',
                    'messages' => [
                        'required' => 'You need to enter a title',
                    ]
                ]
            ],
        ],

        'slug' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsSlug',
            'tab' => 'Pagina',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Slug',
                'placeholder' => 'Enter a slug',
                'autoSlugField' => 'name_[[languageId]]',
                'validation' => [
                    'rules' => 'required',
                    'messages' => [
                        'required' => 'You need to enter a slug',
                    ]
                ],
                'onlyForSuperAdmin' => true
            ]
        ],

        'parent_id' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsSelect',
            'tab' => 'Pagina',
            'options' => [
                'class' => 'hidden',
                'label' => 'Parent page',
                'placeholder' => 'Select a parent page',
                'data' => 'Komma\Kms\NewsItems\NewsItemRepository@getForSelect',
                'exclude' => '[[entityId]]',
//                'data_example' => [
//                    ['value' => 'Faes', 'content' => 'Data: test', 'htmlContent' => '<i>Data: test</i>'],
//                    ['value' => 'Faas', 'content' => 'Data: testen', 'htmlContent' => '<i>Data: testen</i>'],
//                    ['value' => 'Faesch', 'content' => 'Data: tester', 'htmlContent' => '<i>Data: tester</i>'],
//                ],
                'onlyForSuperAdmin' => true
            ]
        ],
        'route' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsRoute',
            'tab' => 'Pagina',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Webadres',
                'class' => 'hidden',
                'placeholder' => 'Wordt automatisch gegenereerd',
                'structure' => '{{parentSlugs}}{{slug}}',
                'slugField' => 'slug_[[languageId]]',
                'parentField' => 'parent_id',
                'rest_route' => 'news/[[id]]',
                'validation' => [
                    'rules' => 'required|unique:routes,route,[[routableId]],routable_id|different:[[routesInOtherLanguages]]',
                    'messages' => [
                        'required' => 'You need to enter a route',
                        'unique' => 'This route already exists',
                        'different' => 'This route needs to be unique'
                    ]
                ],
                'onlyForSuperAdmin' => true

            ]
        ],

        'description' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsDynamic',
            'tab' => 'Pagina',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Artikel',
                'placeholder' => 'Enter a description'
            ]
        ],

    ];

    function __construct(
        Kms $kms,
        NewsItemRepository $repository,
        KmsSectionTabs $tabs)
    {
        parent::__construct($kms, $repository, $tabs);
    }
}