WP_Navigation_Block_Renderer::render()public staticWP 6.5.0

Renders the navigation block.

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

Хуков нет.

Возвращает

Строку. Returns the navigation block markup.

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

$result = WP_Navigation_Block_Renderer::render( $attributes, $content, $block );
$attributes(массив) (обязательный)
The block attributes.
$content(строка) (обязательный)
The saved content.
$block(WP_Block) (обязательный)
The parsed block.

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

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

Код WP_Navigation_Block_Renderer::render() WP 6.7.1

public static function render( $attributes, $content, $block ) {
	/**
	 * Deprecated:
	 * The rgbTextColor and rgbBackgroundColor attributes
	 * have been deprecated in favor of
	 * customTextColor and customBackgroundColor ones.
	 * Move the values from old attrs to the new ones.
	 */
	if ( isset( $attributes['rgbTextColor'] ) && empty( $attributes['textColor'] ) ) {
		$attributes['customTextColor'] = $attributes['rgbTextColor'];
	}

	if ( isset( $attributes['rgbBackgroundColor'] ) && empty( $attributes['backgroundColor'] ) ) {
		$attributes['customBackgroundColor'] = $attributes['rgbBackgroundColor'];
	}

	unset( $attributes['rgbTextColor'], $attributes['rgbBackgroundColor'] );

	$inner_blocks = static::get_inner_blocks( $attributes, $block );
	// Prevent navigation blocks referencing themselves from rendering.
	if ( block_core_navigation_block_contains_core_navigation( $inner_blocks ) ) {
		return '';
	}

	static::handle_view_script_module_loading( $attributes, $block, $inner_blocks );

	return sprintf(
		'<nav %1$s>%2$s</nav>',
		static::get_nav_wrapper_attributes( $attributes, $inner_blocks ),
		static::get_wrapper_markup( $attributes, $inner_blocks )
	);
}