WP_Admin_Bar::_render_group( object $node, string|bool $menu_title = false )

In this article

Parameters

$nodeobjectrequired
$menu_titlestring|booloptional
The accessible name of this ARIA menu or false if not provided.

Default:false

Source

final protected function _render_group( $node, $menu_title = false ) {
	if ( 'container' === $node->type ) {
		$this->_render_container( $node );
		return;
	}
	if ( 'group' !== $node->type || empty( $node->children ) ) {
		return;
	}

	if ( ! empty( $node->meta['class'] ) ) {
		$class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"';
	} else {
		$class = '';
	}

	if ( empty( $menu_title ) ) {
		echo "<ul role='menu' id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$class>";
	} else {
		echo "<ul role='menu' aria-label='" . esc_attr( $menu_title ) . "' id='" . esc_attr( 'wp-admin-bar-' . $node->id ) . "'$class>";
	}
	foreach ( $node->children as $item ) {
		$this->_render_item( $item );
	}
	echo '</ul>';
}

Changelog

VersionDescription
6.5.0Added $menu_title parameter to allow an ARIA menu name.
3.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.