HEX
Server: Apache
System: Linux beta.alfanet.ee 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: busines1 (1252)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home-ssd1/busines1/www/wp-content/plugins/acfml/classes/FieldGroup/TranslationEditorHooks.php
<?php

namespace ACFML\FieldGroup;

use WPML\LIB\WP\Hooks;
use function WPML\FP\spreadArgs;

class TranslationEditorHooks implements \IWPML_Backend_Action {

	/**
	 * @return void
	 */
	public function add_hooks() {
		Hooks::onFilter( 'wpml_use_tm_editor', 10, 2 )
			->then( spreadArgs( [ $this, 'disableTranslationEditor' ] ) );
	}

	/**
	 * @param bool $useEditor
	 * @param int  $postId
	 *
	 * @return bool
	 */
	public function disableTranslationEditor( $useEditor, $postId ) {
		$alreadyDisabled = ! $useEditor;

		return $alreadyDisabled ? false : Mode::LOCALIZATION !== Mode::getForFieldableEntity( 'post', $postId );
	}
}