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/EUmans/umansradepo.be/workbench/komma/kms/src/Komma/Kms/Pages/PageSection.php
<?php
/**
 * Short description for the file.
 *
 * @author      Komma <info@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

namespace Komma\Kms\Pages;

use Komma\Kms\Pages\Models\Page;
use Komma\Kms\Core\Kms;
use Komma\Kms\Core\Sections\KmsSectionTabs;
use Komma\Kms\Core\Sections\KmsSection;

class PageSection extends KmsSection
{
    protected $title = "Pagina&lsquo;s";
    protected $subTitle = "Admin";
    protected $slug = "pages";

    public $showSave = 'all';         // Options: 'all' | 'admin' (SuperAdmin only) | 'none' (or anything else what isn't all or admin)
    public $showDelete = 'admin';
    public $showCreate = 'admin';

    protected $entityAttributesData = [
        // Pages Attributes
        'page_label' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsTitle',
            'options' => [
                'title' => 'Admin only',
                'onlyForSuperAdmin' => true
            ],
        ],

        'active' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsOnOff',
            'options' => [
                'label' => 'active',
                //'class' => 'hidden'
            ],
        ],

        'code_name' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsTextField',
            'options' => [
                'label' => 'Code_name',
                'placeholder' => 'Enter a name',
                'onlyForSuperAdmin' => true
            ]
        ],

        'parent_id' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsSelect',
            'options' => [
                'label' => 'Parent page',
                'placeholder' => 'Select a parent page',
                'data' => 'Komma\Kms\Pages\PageRepository@getForSelect',
                'exclude' => '[[entityId]]',
                'onlyForSuperAdmin' => true
            ],
        ],

        'block_ids' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsMultiSelect',
            'options' => [
                'label' => 'Blokken',
                'placeholder' => 'select block',
                'data' => 'Komma\Kms\Blocks\BlockRepository@getForSelect',
                'onlyForSuperAdmin' => true
            ]
        ],

        'images' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsImages',
            'options' => [
                'label' => 'Images',
                'subFolder' => 'pages',
                'maxImages' => 3,
                'uploadSizes' => [
                    'original' => ['method' => 'fit', 'width' => 2000, 'height' => 8000],
                    'large' => ['method' => 'fit', 'width' => 1200, 'height' => 8000],
                    'medium' => ['method' => 'fit', 'width' => 500, 'height' => 8000],
                    'thumb' => ['method' => 'crop', 'width' => 128, 'height' => 128]
                ],
                'uploadRules' => [
                    //Possible uploadRules max-height(x),min-height(x),max-width(x),min-width(x),max-size(xMB), min-size(xMB)
                    'max-height' => "4000", //default 4000
                    'max-size' => '2MB' // default 5MB
                ],
            ]
        ],

        'spacer' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsSeparator',
            'options' => [
                'onlyForSuperAdmin' => true
            ]
        ],

        'name' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsTextField',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Titel',
                //'class' => 'hidden',
                'placeholder' => 'Kies een passende titel voor het pagina',
            ],
        ],

        'route' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsRoute',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Webadres',
                'class' => 'hidden',
                'placeholder' => 'Wordt automatisch gegenereerd',
                'structure' => '{{parentSlugs}}{{slug}}',
                'slugField' => 'slug_[[languageId]]',
                'parentField' => 'parent_id',
                'rest_route' => 'pages/[[id]]',
                'validation' => [
                    'rules' => 'required_if_not_empty:name_[[languageId]]',
                    'messages' => [
                        'required' => 'You need to enter a route',
                        'unique' => 'This route already exists',
                        'different' => 'This route needs to be unique'
                    ]
                ],

            ]
        ],

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

        'meta_title' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsTextField',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Meta Titel',
                'placeholder' => 'Kies de meta title',
                'validation' => [
                    'rules' => 'required_if_not_empty:name_[[languageId]]',
                    'messages' => [
                        'required' => 'You need to enter a meta title',
                    ]
                ],
            ],
        ],

        'meta_description' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsTextField',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Meta Description',
                'placeholder' => 'Kies de meta description',
                'validation' => [
                    'rules' => 'required_if_not_empty:name_[[languageId]]',
                    'messages' => [
                        'required' => 'You need to enter a meta description',
                    ]
                ],
            ],
        ],

        //Images per language
        'images_lang' => [
            'type' => 'Komma\Kms\Core\Attributes\KmsImages',
            'forEach' => 'AllLanguages',
            'options' => [
                'label' => 'Overwrite images',
                'subFolder' => 'pages',
                'class' => 'hidden',
                'maxImages' => 3,
                'uploadSizes' => [
                    'original' => ['method' => 'fit', 'width' => 2000, 'height' => 8000],
                    'large' => ['method' => 'fit', 'width' => 1200, 'height' => 8000],
                    'medium' => ['method' => 'fit', 'width' => 500, 'height' => 8000],
                    'thumb' => ['method' => 'crop', 'width' => 128, 'height' => 128]
                ],
                'uploadRules' => [
                    //Possible uploadRules max-height(x),min-height(x),max-width(x),min-width(x),max-size(xMB), min-size(xMB)
                    'max-height' => "4000", //default 4000
                    'max-size' => '2MB' // default 5MB
                ],
            ]
        ],
    ];

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