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/ZelfVerkopen/zelfverkopen.nl/app/KommaApp/PostAuthors/Kms/PostAuthorSection.php
<?php

namespace App\KommaApp\PostAuthors\Kms;

use App\KommaApp\Kms\Core\Attributes\Attribute;
use App\KommaApp\Kms\Core\Attributes\AutocompleteInput;
use App\KommaApp\Kms\Core\Attributes\Images;
use App\KommaApp\Kms\Core\Attributes\Models\ImageProperty;
use App\KommaApp\Kms\Core\Attributes\TextField;
use App\KommaApp\Kms\Core\Attributes\Title;
use App\KommaApp\Kms\Core\Sections\NoLanguageTabsDirector;
use App\KommaApp\Kms\Core\Sections\Section;
use App\KommaApp\Kms\Core\Sections\SectionTabGroups;
use App\KommaApp\Kms\Core\Sections\SectionTabItem;
use App\KommaApp\Kms\Core\Sections\SectionTabsBuilder;
use App\KommaApp\Kms\Core\Sections\SectionTabsCollection;
use App\KommaApp\Languages\Kms\LanguageService;
use App\KommaApp\Routes\RouteService;
use App\KommaApp\Users\Roles;
use Illuminate\Database\Eloquent\Collection;

class PostAuthorSection extends Section
{
    protected $title = "Blog | Schijvers";
    protected $subTitle = "Overzicht";
    protected $slug = "postauthors";

    private $languageService;

    /**
     * SiteSection constructor.
     * @param PostAuthorService $postAuthorService
     * @param RouteService $routeService
     * @param LanguageService $languageService
     */
    function __construct(PostAuthorService $postAuthorService, RouteService $routeService, LanguageService $languageService)
    {
        $sectionTabDirector = new NoLanguageTabsDirector(new SectionTabsBuilder()); //Can make tabs for us. also see KmsSection::__construct

        $this->languageService = $languageService;

        parent::__construct($postAuthorService, $routeService, $sectionTabDirector);
    }

    /**
     * Generates the attributes for this section. They all must extend the App\KommaApp\Kms\Core\Attributes\Attribute class
     *
     * @return Collection A collection of SectionTabItems
     */
    protected function generateAttributes(): Collection
    {
        //*****************************************************************************************\\
        //*** Generate the attributes                                                           ***\\
        //*****************************************************************************************\\
        $attributes = [];

        $attributes[] = (new TextField(__('kms/postauthors.name')))
            ->setPlaceholderText(__('kms/postauthors.enter_name'))
            ->mapValueFrom(Attribute::ValueFromModel, 'name');

        $attributes[] = (new Images())
            ->setImageSizes([
                (new ImageProperty())->setName('thumb')->setCropMethod(ImageProperty::Fit)->setWidth(100),
                (new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Resize)->setWidth(65)->setHeight(65),
                (new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Resize)->setWidth(250)->setHeight(8000),
                (new ImageProperty())->setName('large')->setCropMethod(ImageProperty::Resize)->setWidth(500)->setHeight(8000),
                (new ImageProperty())->setName('original')->setCropMethod(ImageProperty::Resize)->setWidth(1500)->setHeight(8000) ,
            ])
            ->setLabelText(__('kms/postauthors.images'))
            ->setMaxImages(1)
            ->setSubFolder('post_authors')
            ->mapValueFrom(Attribute::ValueFromImages, 'images');

        //****************************************************************************************************************************************\\
        //*** Put the all attributes in a SectionTabItem so we can track for which tab they are. And then put SectionTabItems in a Collection  ***\\
        //****************************************************************************************************************************************\\
        $tabItems = new Collection();
        foreach($attributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::General));

        return $tabItems;
    }


}