HEX
Server: LiteSpeed
System: Linux pulsar191.sitesanctuary.org 5.14.0-284.30.1.el9.tuxcare.els9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 10 17:34:05 UTC 2025 x86_64
User: lgooir (1604)
PHP: 8.1.32
Disabled: exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/lgooir/.trash/persian-elementor/widget/class-group-control-typography.php
<?php
// Check if Elementor is loaded before proceeding
if (!did_action('elementor/loaded')) {
    return;
}

class Persian_Elementor_Extended_Group_Control_Typography extends \Elementor\Group_Control_Typography {

    protected function init_fields() {
        $fields = parent::init_fields();

        $new_field = [
            'font-feature-settings' => [
                'label' => esc_html_x('اعداد فارسی', 'Typography Control', 'persian-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'default' => '',
                'description' => 'تغییر اعداد انگلیسی به اعداد فارسی',
                'label_on' => esc_html__('بله', 'persian-elementor'),
                'label_off' => esc_html__('خیر', 'persian-elementor'),
                'return_value' => '"numr"',
				'condition' => [
                    'font_family' => [
					'Anjoman',
					'Artin',
					'Aviny',
					'Daal',
					'Damavand',
					'Dana',
					'Emkan',
					'Estedad',
					'Farhang',
					'Gandom',
					'IRANSansDN',
					'IRANSansX',
					'IRANSharp',
					'IRANYekanX',
					'Kalameh',
					'Kara',
					'Katibeh',
					'Maneli',
					'Mikhak',
					'Nahid',
					'Noora',
					'Parastoo',
					'Pelak',
					'Peyda',
					'Ravi',
					'Sahel',
					'Samim',
					'Shabnam',
					'Tanha',
					'VazirMatn',
					'YekanBakh',]
					],
            ]
        ];

        $position = 'after';
        $target_field = 'font_family';

        $new_fields = [];
        foreach ($fields as $field_name => $field) {
            if ($position === 'before' && $field_name === $target_field) {
                $new_fields = array_merge($new_fields, $new_field);
            }
            
            $new_fields[$field_name] = $field;
            
            if ($position === 'after' && $field_name === $target_field) {
                $new_fields = array_merge($new_fields, $new_field);
            }
        }

        return $new_fields;
    }

    protected function get_default_options() {
        return [
            'popover' => [
                'starter_name' => 'typography',
                'starter_title' => esc_html__('تایپوگرافی', 'persian-elementor'),
                'settings' => [
                    'render_type' => 'ui',
                    'groupType' => 'typography',
                    'global' => [
                        'active' => true,
                    ],
                ],
            ],
        ];
    }
}

// Handle both the legacy and current registration methods for Elementor
if (version_compare(ELEMENTOR_VERSION, '3.5.0', '>=')) {
    add_action('elementor/controls/register', function($controls_manager) {
        $controls_manager->add_group_control(
            Persian_Elementor_Extended_Group_Control_Typography::get_type(), 
            new Persian_Elementor_Extended_Group_Control_Typography()
        );
    });
} else {
    // For older versions of Elementor
    add_action('elementor/controls/controls_registered', function($controls_manager) {
        $controls_manager->add_group_control(
            'typography', 
            new Persian_Elementor_Extended_Group_Control_Typography()
        );
    });
}