How to create a KAS Link / URL - getPath()

Since sections are generated dynamically, the URLs are also variable, which means you can't simply make a link to a page because eventually that URL won't be the same. So we need to find a way to generate a stable URL and get the link to a page.

getPath() resolves native routes from the registered main section, subsection and page names. Use actual registered names rather than copying numeric route IDs.

Full arrays are the modern extensible configuration. Strings remain supported legacy shorthand/quick syntax. Prefer full arrays for new definitions; use only keys supported by the owning field or component.

$url = getPath([
    'menuName' => 'CATALOG', 'submenuName' => 'ITEMS',
    'pageName' => 'VIEW ITEMS', 'query' => '?mode=summary'
]);

The names above are placeholders for your own registration. Supported array keys are menuName, submenuName, pageName, type, optiontype, id and query. query includes its leading question mark.

$editUrl = getPath([
    'menuName' => 'CATALOG', 'submenuName' => 'ITEMS',
    'pageName' => 'EDIT ITEM', 'type' => 'edit',
    'optiontype' => 'FU', 'id' => $itemId
]);
$addUrl = getPath([
    'menuName' => 'CATALOG', 'submenuName' => 'ITEMS',
    'pageName' => 'ADD ITEM', 'optiontype' => 'FA'
]);

An explicit option string with an omitted id gets the native zero placeholder. It is not a saved record ID. type=self_edit supplies the newly inserted ID through the normal save-return flow. Authorize the target record; a route is not permission.

Compatible shorthand and pagination

$url = getPath('CATALOG', 'ITEMS', 'VIEW ITEMS');
$url = getPath('CATALOG', 'ITEMS', 'VIEW ITEMS', '', '200-50-0');

The pagination example starts at row200 with50 results and category0; use the route convention required by the owning view. Positional signatures remain supported. See Next Page After Saving for $nexturl and native save navigation.