WP_Navigation_Block_Renderer::get_classes()private staticWP 6.5.0

Return classes for the navigation block.

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

Хуков нет.

Возвращает

Строку. Returns the classes for the navigation block.

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

$result = WP_Navigation_Block_Renderer::get_classes( $attributes );
$attributes(массив) (обязательный)
The block attributes.

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

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

Код WP_Navigation_Block_Renderer::get_classes() WP 6.7.1

private static function get_classes( $attributes ) {
	// Restore legacy classnames for submenu positioning.
	$layout_class       = static::get_layout_class( $attributes );
	$colors             = block_core_navigation_build_css_colors( $attributes );
	$font_sizes         = block_core_navigation_build_css_font_sizes( $attributes );
	$is_responsive_menu = static::is_responsive( $attributes );

	// Manually add block support text decoration as CSS class.
	$text_decoration       = $attributes['style']['typography']['textDecoration'] ?? null;
	$text_decoration_class = sprintf( 'has-text-decoration-%s', $text_decoration );

	$classes = array_merge(
		$colors['css_classes'],
		$font_sizes['css_classes'],
		$is_responsive_menu ? array( 'is-responsive' ) : array(),
		$layout_class ? array( $layout_class ) : array(),
		$text_decoration ? array( $text_decoration_class ) : array()
	);
	return implode( ' ', $classes );
}