acf_field_select::format_value_single()publicACF 1.0

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

Хуков нет.

Возвращает

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

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

$acf_field_select = new acf_field_select();
$acf_field_select->format_value_single( $value, $post_id, $field );
$value (обязательный)
-
$post_id (обязательный)
-
$field (обязательный)
-

Код acf_field_select::format_value_single() ACF 6.0.4

function format_value_single( $value, $post_id, $field ) {

	// bail early if is empty
	if ( acf_is_empty( $value ) ) {
		return $value;
	}

	// vars
	$label = acf_maybe_get( $field['choices'], $value, $value );

	// value
	if ( $field['return_format'] == 'value' ) {

		// do nothing

		// label
	} elseif ( $field['return_format'] == 'label' ) {

		$value = $label;

		// array
	} elseif ( $field['return_format'] == 'array' ) {

		$value = array(
			'value' => $value,
			'label' => $label,
		);

	}

	// return
	return $value;

}