<?php
if ( ( class_exists( 'LearnDash_Translations' ) ) && ( !class_exists( 'LearnDash_Settings_Section_Translations_Learndash_ProPanel' ) ) ) {
	class LearnDash_Settings_Section_Translations_Learndash_ProPanel extends LearnDash_Settings_Section {

		// Must match the Text Domain
		private $project_slug = 'ld_propanel';
		private $registered = false;
		
		function __construct() {
			// This will match the page slug in LearnDash. Should not need to be changed. 
			$this->settings_page_id					=	'learndash_lms_translations';
		
			// Used within the Settings API to uniquely identify this section
			$this->settings_section_key				= 	'settings_translations_'. $this->project_slug;
		
			// Section label/header
			$this->settings_section_label			=	__( 'LearnDash ProPanel', 'ld_propanel' );
		
			if ( class_exists( 'LearnDash_Translations' ) ) {
				if ( method_exists( 'LearnDash_Translations', 'register_translation_slug' ) ) {
					$this->registered = true;
					LearnDash_Translations::register_translation_slug( $this->project_slug, LD_PP_PLUGIN_DIR .'languages' );
				} 
			} 
			
			parent::__construct(); 
		}

		function add_meta_boxes( $settings_screen_id = '' ) {
			if ( ( $settings_screen_id == $this->settings_screen_id ) && ( $this->registered === true ) ) {
				parent::add_meta_boxes( $settings_screen_id );
			}
		}
		
		function show_meta_box() {
			$ld_translations = new LearnDash_Translations( $this->project_slug );
			$ld_translations->show_meta_box();
		}
	}
	LearnDash_Settings_Section_Translations_Learndash_ProPanel::add_section_instance();
}

