File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Products/ProductComposite/ProductCompositeSection.php
<?php
//
//
//namespace App\Products\ProductComposite;
//
////The new object oriented attributes
//use Komma\KMS\Core\Attributes\Attribute;
//use Komma\KMS\Core\Attributes\MultiSelect;
//use Komma\KMS\Core\Attributes\Documents;
//use Komma\KMS\Core\Attributes\Models\ImageProperty;
//use Komma\KMS\Core\Attributes\OnOff;
//use Komma\KMS\Core\Attributes\Seperator;
//use Komma\KMS\Core\Attributes\TextArea;
//use Komma\KMS\Core\Attributes\TextField;
//use Komma\KMS\Core\Attributes\Title;
//use App\Categories\Kms\CategoryModelService;
//use App\Products\ProductGroup\ProductGroupModelService;
//use App\Properties\Kms\PropertyService;
//use Illuminate\Database\Eloquent\Model;
//use Illuminate\Support\Collection;
//
//class ProductCompositeSection extends Section
//{
// /** @var CategoryModelService $categoryService */
// protected $categoryService;
//
// /** @var PropertyService $propertyService */
// protected $propertyService;
//
// /** @var ProductCompositeModelService */
// private $productCompositeModelService;
//
// /** @var ProductGroupModelService */
// private $productGroupModelService;
//
// /**
// * ProductComposite constructor.
// *
// * @param $slug
// */
// function __construct(string $slug)
// {
// $this->categoryService = \App::make(CategoryModelService::class);
// $this->propertyService = \App::make(PropertyService::class);
// $this->productCompositeModelService = new ProductCompositeModelService();
// $this->productGroupModelService = new ProductGroupModelService();
//
// $tabs = new AllUsedLanguagesTabs();
// parent::__construct($tabs, $slug);
// $this->setSectionTitle(ucfirst(__("KMS::product_composites.section.title")));
// $this->setSectionNewModelTranslation(ucfirst(__("KMS::product_composites.section.new")));
// }
//
// /**
// * Generates the attributes for this section. They all must extend the App\Kms\Core\Attributes\Attribute class
// * This is the place where you need to setup your sections appearance. Just make sure you build an array of attributes
// * and put each attribute in a AbstractSectionTabItem with a SectionTabGroups constant to link them to a tab.
// *
// * @param Model $currentModel
// * @return Collection A collection of SectionTabItems
// */
// protected function generateAttributes(Model $currentModel = null): Collection
// {
//
// //*****************************************************************************************\\
// //*** Generate the attributes ***\\
// //*****************************************************************************************\\
// $attributes = [];
//
// //Build the general attributes and put them in the attributes array
// $attributes[] = (new Title())
// ->setLabelText(__('shop/categories.category'));
// $categoryOptionModels = $this->categoryService->getOptionsForSelect();
// $attributes[] = (new MultiSelect())
// ->setItems($categoryOptionModels->toArray())
// ->setLabelText(__('shop/categories.category'))
// ->mapValueFrom(Attribute::ValueFromItself, 'category_id');
// $attributes[] = (new Seperator());
//
// //Site selection
// $attributes[] = (new Title())
// ->setLabelText(__('kms/sites.type'));
//
// $siteOptionModels = $this->siteService->getOptionsForSelect();
// $attributes[] = (new MultiSelect())
// ->setItems($siteOptionModels->toArray())
// ->setLabelText(__('kms/sites.type'))
// ->mapValueFrom(Attribute::ValueFromItself, 'site_id');
// $attributes[] = (new Seperator());
//
//
// $attributes[] = (new Title())
// ->setLabelText(__('shop/products.product_composite'));
//
// $attributes[] = (new OnOff())
// ->setLabelText(__('kms/global.active'))
// ->switchOn()
// ->setReference( 'active');
//
// $productGroupOptionModels = $this->productGroupModelService->getOptionModelsForProductGroupSelect();
// $attributes[] = (new MultiSelect())
// ->setItems($productGroupOptionModels)
// ->setLabelText(__('shop/products.product_groups'))
// ->mapValueFrom(Attribute::ValueFromModelHasManyRelation, 'groups|id');
//
// $attributes[] = (new Documents())
// ->setImageProperties([
// (new ImageProperty())->setName('thumb')->setCropMethod(ImageProperty::Fit)->setWidth(100),
// (new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Fit)->setWidth(240),
// (new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Fit)->setWidth(460),
// (new ImageProperty())->setName('large')->setCropMethod(ImageProperty::Fit)->setWidth(500),
// ])
// ->setLabelText(__('kms/global.images'))
// ->setMaxDocuments(5)
// ->setSubFolder('productcomposites')
// ->mapValueFrom(Attribute::ValueFromDocuments, 'images');
//
// //Properties selection
// $attributes[] = (new Seperator());
// $attributes[] = (new Title())
// ->setLabelText(__('shop/properties.properties'));
//
// $propertyOptionModels = $this->propertyService->getOptionsForSelect();
// $attributes[] = (new MultiSelect())
// ->setItems($propertyOptionModels->toArray())
// ->setLabelText(__('shop/properties.property'))
// ->mapValueFrom(Attribute::ValueFromItself, 'property_id');
//
// //Build an array with attributes for each current site language
// $languageIndexedAttributes = $this->createAttributesFromExistingAttributeForAllUsedLanguagesBySites([
// (new Title())
// ->setLabelText(__('kms/global.information')),
//
// (new TextField())
// ->setLabelText(__('kms/global.title'))
// ->setPlaceholderText(__('kms/global.enterTitle'))
// ->setRules('required')
// ->setReference( 'name'),
//
// (new TextArea())
// ->setLabelText(__('kms/global.metaDescription'))
// ->setPlaceholderText(__('kms/global.enterMetaDescription'))
// ->setReference( 'meta_description'),
//
// (new TextArea())
// ->setLabelText(__('kms/global.description'))
// ->setPlaceholderText(__(''))
// ->setReference( 'description')
// ]);
//
// //Return all attributes as a collection
// return collect(array_merge($attributes, $languageIndexedAttributes));
// }
//
// /**
// * This method will stop the load entities of the kmsSiteSection
// *
// * @return array
// *
// */
// public function loadEntities(){
// return [];
// }
//}