Automattic\WooCommerce\Blocks\BlockTypes

CustomerAccount::render_dropdown_menu │ private │ WC 1.0

Render the dropdown menu content with three sections.

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

Хуков нет.

Возвращает

string. Rendered dropdown menu HTML.

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

// private - только в коде основоного (родительского) класса
$result = $this->render_dropdown_menu( $menu_items );
$menu_items(массив) (обязательный)
Account menu items from wc_get_account_menu_items().

Код CustomerAccount::render_dropdown_menu() WC 11.3.0

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 );
}