Files
esun3d/app/code/Esun/MultiLocaleTranslation/Model/Config/Source/SkippedFields.php
T
2026-09-15 10:35:56 +08:00

80 lines
2.8 KiB
PHP

<?php
declare(strict_types=1);
namespace Esun\MultiLocaleTranslation\Model\Config\Source;
use Magento\Framework\Data\OptionSourceInterface;
class SkippedFields implements OptionSourceInterface
{
public function toOptionArray(): array
{
return [
$this->group('Category', 'category', [
'name' => 'Name',
'description' => 'Description',
'meta_title' => 'Meta Title',
'meta_keywords' => 'Meta Keywords',
'meta_description' => 'Meta Description',
]),
$this->group('Product', 'product', [
'name' => 'Name',
'description' => 'Description',
'short_description' => 'Short Description',
'meta_title' => 'Meta Title',
'meta_keyword' => 'Meta Keywords',
'meta_description' => 'Meta Description',
]),
$this->group('CMS Page', 'cms_page', [
'title' => 'Title',
'content_heading' => 'Content Heading',
'content' => 'Content',
'meta_title' => 'Meta Title',
'meta_keywords' => 'Meta Keywords',
'meta_description' => 'Meta Description',
]),
$this->group('CMS Block', 'cms_block', [
'title' => 'Title',
'content' => 'Content',
]),
$this->group('Blog Post', 'blog_post', [
'name' => 'Post Name',
'short_description' => 'Short Description',
'post_content' => 'Content',
'meta_title' => 'Meta Title',
'meta_keywords' => 'Meta Keywords',
'meta_description' => 'Meta Description',
]),
$this->group('Wiki Category', 'wiki_category', [
'title' => 'Title',
'summary' => 'Summary',
'content' => 'Content',
'meta_title' => 'Meta Title',
'meta_description' => 'Meta Description',
'meta_keywords' => 'Meta Keywords',
]),
$this->group('Wiki Homepage', 'wiki_homepage', [
'title' => 'Title',
'content' => 'Content',
'meta_title' => 'Meta Title',
'meta_description' => 'Meta Description',
'meta_keywords' => 'Meta Keywords',
]),
];
}
private function group(string $label, string $entityType, array $fields): array
{
$options = [];
foreach ($fields as $field => $fieldLabel) {
$options[] = [
'value' => $entityType . '.' . $field,
'label' => __($fieldLabel),
];
}
return ['label' => __($label), 'value' => $options];
}
}