ACF_Location_Attachment::get_values()publicACF 5.9.0

Returns an array of possible values for this rule type.

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

Хуков нет.

Возвращает

Массив.

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

$ACF_Location_Attachment = new ACF_Location_Attachment();
$ACF_Location_Attachment->get_values( $rule );
$rule(массив) (обязательный)
A location rule.

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

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

Код ACF_Location_Attachment::get_values() ACF 6.0.4

public function get_values( $rule ) {
	$choices = array(
		'all' => __( 'All', 'acf' ),
	);

	// Get mime types and append into optgroups.
	$mime_types = get_allowed_mime_types();
	foreach ( $mime_types as $regex => $mime_type ) {

		// Get type "image" from mime_type "image/jpeg".
		$type = current( explode( '/', $mime_type ) );

		// Append group and mimetype.
		$choices[ $type ][ $type ]      = sprintf( __( 'All %s formats', 'acf' ), $type );
		$choices[ $type ][ $mime_type ] = "$regex ($mime_type)";
	}

	// return
	return $choices;
}