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/public_html/wp-content/plugins/acfml/classes/Helper/FieldGroup.php
<?php

namespace ACFML\Helper;

use WPML\API\Sanitize;
use WPML\FP\Obj;

class FieldGroup {

	const CPT         = 'acf-field-group';
	const SCREEN_SLUG = 'acf-field-group';

	/**
	 * @return bool
	 */
	public static function isScreen() {
		return acf_is_screen( self::SCREEN_SLUG );
	}

	/**
	 * @return bool
	 */
	public static function isListScreen() {
		global $pagenow;

		return 'edit.php' === $pagenow
			&& self::SCREEN_SLUG === Sanitize::stringProp( 'post_type', $_GET ); // phpcs:ignore
	}

	/**
	 * @param  int $id
	 *
	 * @return int|null
	 */
	public static function getId( $id ) {
		$group = acf_get_field_group( $id );

		if ( $group ) {
			return (int) Obj::prop( 'ID', $group );
		} else {
			$parentId = (int) Obj::prop( 'ID', get_post_parent( $id ) );

			if ( $parentId ) {
				return self::getId( $parentId );
			}
		}

		return null;
	}

	/**
	 * @return bool
	 */
	public static function isTranslatable() {
		return is_post_type_translated( self::CPT );
	}
}