HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //home/globfdxw/public_html/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 );
	}
}