acf_form_customizer::admin_footer()publicACF 5.0.0


This function will add some custom HTML to the footer of the edit page

@type    function

{} Это метод класса: acf_form_customizer{}

Хуков нет.


null. Ничего.


$acf_form_customizer = new acf_form_customizer();

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

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

Код acf_form_customizer::admin_footer() ACF 5.10.2

function admin_footer() {

<script type="text/javascript">
(function($) {
	// customizer saves widget on any input change, so unload is not needed = 0;
	// hack customizer function to remove bug caused by WYSIWYG field using aunique ID
	// customizer compares returned AJAX HTML with the HTML of the widget form.
	// the _getInputsSignature() function is used to generate a string based of input name + id.
	// because ACF generates a unique ID on the WYSIWYG field, this string will not match causing the preview function to bail.
	// an attempt was made to remove the WYSIWYG unique ID, but this caused multiple issues in the wp-admin and altimately doesn't make sense with the tinymce rule that all editors must have a unique ID.
	// source: wp-admin/js/customize-widgets.js
	// vars
	var WidgetControl = wp.customize.Widgets.WidgetControl.prototype;
	// backup functions
	WidgetControl.__getInputsSignature = WidgetControl._getInputsSignature;
	WidgetControl.__setInputState = WidgetControl._setInputState;
	// modify __getInputsSignature
	WidgetControl._getInputsSignature = function( inputs ) {

// vars
var signature = this.__getInputsSignature( inputs );
	safe = [];

// split
signature = signature.split(';');

// loop
for( var i in signature ) {
	// vars
	var bit = signature[i];
	// bail ealry if acf is found
	if( bit.indexOf('acf') !== -1 ) continue;
	// append
	safe.push( bit );

// update
signature = safe.join(';');

// return
return signature;

	// modify _setInputState
	// this function deosn't seem to run on widget title/content, only custom fields
	// either way, this function is not needed and will break ACF fields 
	WidgetControl._setInputState = function( input, state ) {

return true;