---
title: Render favourites
summary: Render the favourites list — the user's pinned pages plus, for external clients, a self-service password-change link.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2.Menu
reference_type: package
operation_id: OP-MENU-004
trigger: "`SAIFMenu.AddFavorites`, invoked from `CreateControls` during `OnLoad`."
---

# Render favourites

Render the favourites list — the user's pinned pages plus, for external clients, a self-service password-change link. This operation is implemented by `SAIFMenu.AddFavorites`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MENU-004 |
| **Trigger** | `SAIFMenu.AddFavorites`, invoked from `CreateControls` during `OnLoad`. |
| **Inputs** | `NavigationData.MenuAuthorizedItems.Favorites`; `AppGlobal.EnvironmentService.IsClientExternal`; current item. |
| **Outputs** | One `LinkButton` per favourite, wired to `LinkButtonClick`; an optional `ChangePWLink`. |
| **Primary components** | `SAIFMenu.AddFavorites` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb` |

## Steps

1. In design mode, emit three placeholder favourite links (`Favorite 1`–`3`). Enforces [BR-MENU-018](../business-rules.md#br-menu-018-design-mode-shows-placeholder-favourites).
2. At run time, take `NavigationData.MenuAuthorizedItems.Favorites` and, when non-empty, sort it by `MenuOrder`. Enforces [BR-MENU-019](../business-rules.md#br-menu-019-favourites-are-displayed-in-menuorder-sequence).
   - Delegates sorting to `clsMenuAuthorizedItemCollection` in `SAIF.Business.Menu`.
3. For each favourite create a `LinkButton` with ID `<controlId>fav_LB<MenuItemSeqNum>`, tooltip `<MenuCategory> - <ToolTip>` and text `FavoritePageName`, wired to `LinkButtonClick`. Enforces [BR-MENU-020](../business-rules.md#br-menu-020-favourite-link-ids-embed-the-menu-item-sequence-number), [BR-MENU-021](../business-rules.md#br-menu-021-a-favourites-tooltip-combines-its-menu-category-and-item-tooltip).
4. Style the link `favoriteitem-selected` when its `MenuPageSeqNum` matches the current item; otherwise `favoriteitem`. Enforces [BR-MENU-022](../business-rules.md#br-menu-022-the-favourite-matching-the-current-page-is-highlighted).
5. If `AppGlobal.EnvironmentService.IsClientExternal` is true, append a "Change Password" link. Enforces [BR-MENU-023](../business-rules.md#br-menu-023-the-change-password-link-is-offered-only-to-external-clients).
   - Delegates to the SAIF framework environment service.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["SAIFMenu.AddFavorites"]) --> Design{Design mode?}
	Design -->|Yes| Placeholders(["Emit placeholder favourite links 1-3"])
	Design -->|No| Sort["Take MenuAuthorizedItems.Favorites, sort by MenuOrder if non-empty"]
	Sort --> Create["Create LinkButton &lt;controlId&gt;fav_LB&lt;MenuItemSeqNum&gt;"]
	Create --> Tooltip["Set tooltip MenuCategory - ToolTip, text FavoritePageName"]
	Tooltip --> Wire["Wire to LinkButtonClick"]
	Wire --> Style["Style favoriteitem-selected when matching current item"]
	Style --> External{IsClientExternal?}
	External -->|Yes| ChangePw["Append Change Password link"]
	External -->|No| End(["One LinkButton per favourite"])
	ChangePw --> End
```

## Failure and edge-case behavior

- No exceptional failure paths beyond those noted in the steps above.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Presentation.Web.Controls.V2.Menu/SAIFMenu.vb`
