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,22 @@
<?php
declare(strict_types=1);
namespace Esun\Agent\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
class Continent implements OptionSourceInterface
{
public function toOptionArray(): array
{
return [
['value' => 'africa', 'label' => __('Africa')],
['value' => 'asia', 'label' => __('Asia')],
['value' => 'europe', 'label' => __('Europe')],
['value' => 'north_america', 'label' => __('North America')],
['value' => 'south_america', 'label' => __('South America')],
['value' => 'oceania', 'label' => __('Oceania')],
['value' => 'antarctica', 'label' => __('Antarctica')],
];
}
}
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Esun\Agent\Model\Source;
use Esun\Agent\Model\Map\CountryPosition;
use Magento\Directory\Model\Config\Source\Country;
use Magento\Framework\Data\OptionSourceInterface;
class MapCountry implements OptionSourceInterface
{
public function __construct(
private readonly Country $countrySource,
private readonly CountryPosition $countryPosition
) {
}
public function toOptionArray(): array
{
return array_values(array_filter(
$this->countrySource->toOptionArray(),
fn (array $option): bool => (string) ($option['value'] ?? '') === ''
|| $this->countryPosition->has((string) $option['value'])
));
}
}