Automattic\WooCommerce\Blocks\BlockTypes

CustomerAccount::render_dropdown_menuprivateWC 1.0

Render the dropdown menu content with three sections.

Method of the class: CustomerAccount{}

No Hooks.

Returns

String. Rendered dropdown menu HTML.

Usage

// private - for code of main (parent) class only
$result = $this->render_dropdown_menu( $menu_items );
$menu_items(array) (required)
Account menu items from wc_get_account_menu_items().

CustomerAccount::render_dropdown_menu() code WC 10.8.1

private function render_dropdown_menu( $menu_items ) {
	$sections = array();

	if ( isset( $menu_items['dashboard'] ) ) {
		$sections[] = $this->render_section( array( 'dashboard' => $menu_items['dashboard'] ) );
	}

	$nav_items = array_diff_key(
		$menu_items,
		array_flip( array( 'dashboard', 'customer-logout' ) )
	);
	if ( ! empty( $nav_items ) ) {
		$sections[] = $this->render_section( $nav_items );
	}

	if ( isset( $menu_items['customer-logout'] ) ) {
		$sections[] = $this->render_section( array( 'customer-logout' => $menu_items['customer-logout'] ) );
	}

	return implode( '<div class="wc-block-customer-account__dropdown-divider"></div>', $sections );
}