incompatibility with rename_admin paths
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3587741. --> Reported by: [pglatz](https://www.drupal.org/user/109935) Related to !27 >>> <p>I'm using the rename admin paths module to change the admin path. Once I did this, the config page for thesmtp module had no link in the configuration menu. Claude gave me this analysis and fix:</p> <p>The getParentMenuName() method in Api.php (around line 859) was calling Url::fromUri('internal:/' . $path) with hardcoded paths like admin/config/ai. When rename_admin_paths changes /admin to /backend, this path lookup throws an exception.</p> <p>The fix wraps the URL resolution in a try/catch:</p> <p>PHP</p> <p>public function getParentMenuName(string $path): ?string {<br> $parts = explode('/', trim($path, '/'));<br> array_pop($parts);<br> $path = implode('/', $parts);<br> try {<br> $url = Url::fromUri('internal:/' . $path);<br> $links = $this-&gt;menuLinkManager-&gt;loadLinksByRoute($url-&gt;getRouteName(), $url-&gt;getRouteParameters());<br> if (!empty($links)) {<br> $menuLink = reset($links);<br> return $menuLink-&gt;getPluginId();<br> }<br> }<br> catch (\Exception $e) {<br> // Path may not exist if admin paths are renamed.<br> }<br> return NULL;<br> }</p>
issue