Cakephp 3 - creating link with admin prefix not working
<p>I am trying to create a link in the default.ctp layout file that links to an admin page.</p>

<p>In route.php I have this:</p>

<pre><code>Router::prefix('admin', function ($routes) {
    // All routes here will be prefixed with `/admin`
    // And have the prefix =&gt; admin route element added.
    $routes-&gt;connect('/login', array('controller' =&gt; 'Users', 'action' =&gt; 'login'));
    $routes-&gt;connect('/logout', array('controller' =&gt; 'Users', 'action' =&gt; 'logout'));

    $routes-&gt;fallbacks(DashedRoute::class);
});
</code></pre>

<p>In default.ctp template file I have tried this:</p>

<pre><code>echo $this-&gt;Html-&gt;link('Build Settings', '/buildsettings', array('admin' =&gt; true));
echo $this-&gt;Html-&gt;link('Build Settings', '/buildsettings', array('prefix' =&gt; 'admin'));
echo $this-&gt;Html-&gt;link('Build Settings', '/buildsettings', array('prefix' =&gt; 'admin', 'admin' =&gt; true));
</code></pre>

<p>However, the link it creates is this:</p>

<pre><code>&lt;a href="/buildsettings" admin="1"&gt;Build Settings&lt;/a&gt;
</code></pre>

<p>While it should make something like this:</p>

<pre><code>&lt;a href="/admin/buildsettings"&gt;Build Settings&lt;/a&gt;
</code></pre>

<p>Going to <em>/admin/buildsettings</em>, actually goes to the admin buildsettings controller, so I know the routing itself works, just not creating the proper links.</p>

<p>What am I doing wrong here?</p>