29 lines
753 B
PHP
29 lines
753 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\MultiLocaleTranslation\Model\Config;
|
|
|
|
use Magento\Framework\App\Config\ScopeConfigInterface;
|
|
|
|
class SkippedFields
|
|
{
|
|
private const XML_PATH = 'esun_multilocale_translation/general/skipped_fields';
|
|
|
|
public function __construct(
|
|
private readonly ScopeConfigInterface $scopeConfig
|
|
) {
|
|
}
|
|
|
|
public function isSkipped(string $entityType, string $field): bool
|
|
{
|
|
$value = $this->scopeConfig->getValue(self::XML_PATH);
|
|
if (!is_string($value) || trim($value) === '') {
|
|
return false;
|
|
}
|
|
|
|
$skippedFields = array_filter(array_map('trim', explode(',', $value)));
|
|
return in_array($entityType . '.' . $field, $skippedFields, true);
|
|
}
|
|
}
|