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/www/wp-content/plugins/acfml/classes/Field/FrontendHooks.php
<?php

namespace ACFML\Field;

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

class FrontendHooks implements \IWPML_Frontend_Action {

	public function add_hooks() {
		Hooks::onFilter( 'acf/load_value', 10, 3 )
			->then( spreadArgs( [ self::class, 'convertTargetLinks' ] ) );
	}

	/**
	 * @param mixed  $value
	 * @param string $postId
	 * @param array  $field
	 *
	 * @return mixed
	 */
	public static function convertTargetLinks( $value, $postId, $field ) {
		$isWysiwygField = Obj::prop( 'type', $field ) === 'wysiwyg';

		if ( $isWysiwygField && is_string( $value ) ) {
			return apply_filters( 'wpml_translate_link_targets', $value );
		}

		return $value;
	}
}