ACF_Admin_Field_Groups::admin_footer()publicACF 5.9.0

Prints scripts into the admin footer.

Метод класса: ACF_Admin_Field_Groups{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups();
$ACF_Admin_Field_Groups->admin_footer();

Список изменений

С версии 5.9.0 Введена.

Код ACF_Admin_Field_Groups::admin_footer() ACF 6.0.4

<?php
function admin_footer() {
	?>
<script type="text/javascript">
(function($){

	// Displays a modal comparing local changes.
	function reviewSync( props ) {
var modal = acf.newModal({
	title: acf.__('Review local JSON changes'),
	content: '<p class="acf-modal-feedback"><i class="acf-loading"></i> ' + acf.__('Loading diff') + '</p>',
	toolbar: '<a href="' + props.href + '" class="button button-primary button-sync-changes disabled">' + acf.__('Sync changes') + '</a>',
});

// Call AJAX.
var xhr = $.ajax({
	url: acf.get('ajaxurl'),
	method: 'POST',
	dataType: 'json',
	data: acf.prepareForAjax({
		action:	'acf/ajax/local_json_diff',
		id: props.id
	})
})
.done(function( data, textStatus, jqXHR ) {
	modal.content( data.html );
	modal.$('.button-sync-changes').removeClass('disabled');
})
.fail(function( jqXHR, textStatus, errorThrown ) {
	if( error = acf.getXhrError(jqXHR) ) {
		modal.content( '<p class="acf-modal-feedback error">' + error + '</p>' );
	}
});
	}

	// Add event listener.
	$(document).on('click', 'a[data-event="review-sync"]', function( e ){
e.preventDefault();
reviewSync( $(this).data() );
	});
})(jQuery);
</script>
	<?php
}