# `MishkaCmsMigration.Sources.WordPress.Navigation`
[🔗](https://github.com/mishka-group/mishka_cms_migration/blob/v0.0.1/lib/mishka_cms_migration/sources/__wordpress/navigation.ex#L5)

A block theme's menus as the rows of a menu (`MishkaCmsMigration.Sources.WordPress.menus/4`).

A block menu is a `wp_navigation` post whose `content.raw` is block comments
(`MishkaCmsMigration.Sources.WordPress.Content.blocks_in/1` reads them with the HTML parser, never
by pattern): `core/navigation-link` is a link, `core/navigation-submenu` a link with the links
under it, and `core/home-link` the site's home. Any other block (a page list, a search box, a
social link) draws something WordPress works out as it serves the page, so it is not a link of
the menu and is left out.

`call/2` answers a row for each post: its `"id"` is `"navigation-"` and the post's id, so it never
meets the id of a classic menu, its `"name"` the post's title, and `"items"` already nested in
the shape a classic menu's items are given (`MishkaCmsMigration.Sources.WordPress`'s `"menu"`): a
link's `"title"`, `"url"`, the `"kind"` and `"id"` of the page, post, category or tag it points at,
`"new_tab"` and its own `"items"`. A block menu is never the main one, for WordPress sets no theme
location on it.

# `call`

```elixir
@spec call([map()], String.t() | nil) :: [map()]
```

The menu rows of `posts`, the `wp_navigation` posts as the REST API answers them (or rows of the
same shape), with `home`, the site's own address, for the home link.

# `targets`

```elixir
@spec targets([map()]) :: [tuple()]
```

The links of a menu's `items`, as a sorted list of what each points at: `{:object, kind, id}`
for a page, post, category or tag, `{:url, address}` for any other. Two menus with the same list
have the same links, whatever their labels, order and nesting.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
