ACF_WPML_Compatibility::__construct
__construct
Sets up the class functionality.
Method of the class: ACF_WPML_Compatibility{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ACF_WPML_Compatibility = new ACF_WPML_Compatibility(); $ACF_WPML_Compatibility->__construct();
Changelog
| Since 3.1.8 | Introduced. |
ACF_WPML_Compatibility::__construct() ACF WPML Compatibility:: construct code ACF 6.0.4
function __construct() {
// global
global $sitepress;
// update settings
acf_update_setting( 'default_language', $sitepress->get_default_language() );
acf_update_setting( 'current_language', $sitepress->get_current_language() );
// localize data
acf_localize_data(
array(
'language' => $sitepress->get_current_language(),
)
);
// switch lang during AJAX action
add_action( 'acf/verify_ajax', array( $this, 'verify_ajax' ) );
// prevent 'acf-field' from being translated
add_filter( 'get_translatable_documents', array( $this, 'get_translatable_documents' ) );
// check if 'acf-field-group' is translatable
if ( $this->is_translatable() ) {
// actions
add_action( 'acf/upgrade_500_field_group', array( $this, 'upgrade_500_field_group' ), 10, 2 );
add_action( 'icl_make_duplicate', array( $this, 'icl_make_duplicate' ), 10, 4 );
// filters
add_filter( 'acf/settings/save_json', array( $this, 'settings_save_json' ) );
add_filter( 'acf/settings/load_json', array( $this, 'settings_load_json' ) );
}
}