This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace Esun\Catalog\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
class BooleanOptions implements OptionSourceInterface
{
public function toOptionArray(): array
{
return [
['value' => '1', 'label' => __('Yes')],
['value' => '0', 'label' => __('No')],
];
}
}
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Esun\Catalog\Model\Source;
use Esun\Catalog\Model\ResourceModel\SpecificationBrand\CollectionFactory;
use Magento\Framework\Data\OptionSourceInterface;
class SpecificationBrandOptions implements OptionSourceInterface
{
public function __construct(
private readonly CollectionFactory $collectionFactory
) {
}
public function toOptionArray(): array
{
$options = [['value' => '', 'label' => __('Select a brand')]];
$collection = $this->collectionFactory->create()
->addFieldToFilter('status', 1)
->setOrder('sort_order', 'ASC')
->setOrder('brand_name', 'ASC');
foreach ($collection as $brand) {
$options[] = [
'value' => (string)$brand->getId(),
'label' => (string)$brand->getData('brand_name'),
];
}
return $options;
}
}