acf_merge_attributes()ACF 5.7.10

acf_merge_attributes

Merges together two arrays but with extra functionality to append class names.

Хуков нет.

Возвращает

Массив.

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

acf_merge_attributes( $array1, $array2 );
$array1(массив) (обязательный)
An array of attributes.
$array2(массив) (обязательный)
An array of attributes.

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

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

Код acf_merge_attributes() ACF 6.0.4

function acf_merge_attributes( $array1, $array2 ) {

	// Merge together attributes.
	$array3 = array_merge( $array1, $array2 );

	// Append together special attributes.
	foreach ( array( 'class', 'style' ) as $key ) {
		if ( isset( $array1[ $key ] ) && isset( $array2[ $key ] ) ) {
			$array3[ $key ] = trim( $array1[ $key ] ) . ' ' . trim( $array2[ $key ] );
		}
	}

	// Return.
	return $array3;
}