ACF_Admin_Field_Groups::setup_sync() public ACF 5.9.0
Sets up the field groups ready for sync.
{} Это метод класса: ACF_Admin_Field_Groups{}
Хуков нет.
Возвращает
null.
Использование
$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups(); $ACF_Admin_Field_Groups->setup_sync();
- (void) (обязательный)
Список изменений
С версии 5.9.0 | Введена. |
Код ACF_Admin_Field_Groups::setup_sync() ACF Admin Field Groups::setup sync ACF 5.9.1
public function setup_sync() {
// Review local json field groups.
if( acf_get_local_json_files() ) {
// Get all groups in a single cached query to check if sync is available.
$all_field_groups = acf_get_field_groups();
foreach( $all_field_groups as $field_group ) {
// Extract vars.
$local = acf_maybe_get( $field_group, 'local' );
$modified = acf_maybe_get( $field_group, 'modified' );
$private = acf_maybe_get( $field_group, 'private' );
// Ignore if is private.
if( $private ) {
continue;
// Ignore not local "json".
} elseif( $local !== 'json' ) {
continue;
// Append to sync if not yet in database.
} elseif( !$field_group['ID'] ) {
$this->sync[ $field_group['key'] ] = $field_group;
// Append to sync if "json" modified time is newer than database.
} elseif( $modified && $modified > get_post_modified_time('U', true, $field_group['ID']) ) {
$this->sync[ $field_group['key'] ] = $field_group;
}
}
}
}