acf_render_field_setting()ACF 5.7.10

acf_render_field_setting

Renders a field setting used in the admin edit screen.

Хуков нет.

Возвращает

null. Ничего.

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

acf_render_field_setting( $field, $setting, $global );
$field(массив) (обязательный)
The field array.
$setting(массив) (обязательный)
The settings field array.
$global(true|false)
Whether this setting is a global or field type specific one.
По умолчанию: false

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

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

Код acf_render_field_setting() ACF 5.10.2

function acf_render_field_setting( $field, $setting, $global = false ) {

	// Validate field.
	$setting = acf_validate_field( $setting );

	// Add custom attributes to setting wrapper.
	$setting['wrapper']['data-key'] = $setting['name'];
	$setting['wrapper']['class']   .= ' acf-field-setting-' . $setting['name'];
	if ( ! $global ) {
		$setting['wrapper']['data-setting'] = $field['type'];
	}

	// Copy across prefix.
	$setting['prefix'] = $field['prefix'];

	// Find setting value from field.
	if ( $setting['value'] === null ) {

		// Name.
		if ( isset( $field[ $setting['name'] ] ) ) {
			$setting['value'] = $field[ $setting['name'] ];

			// Default value.
		} elseif ( isset( $setting['default_value'] ) ) {
			$setting['value'] = $setting['default_value'];
		}
	}

	// Add append attribute used by JS to join settings.
	if ( isset( $setting['_append'] ) ) {
		$setting['wrapper']['data-append'] = $setting['_append'];
	}

	// Render setting.
	acf_render_field_wrap( $setting, 'tr', 'label' );
}