Back to site link for custom blocks
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3391029. --> Reported by: [andy_w](https://www.drupal.org/user/2581622) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Currently when editing a custom block the "Back to site" button links to the edit page (the page you are already on) due to the fact that custom blocks do not have a standalone view, however the URL does allow access as the canonical url is the edit form.</p> <p>The expected behaviour would be the same as media (when not allowing media to be viewed standalone) i.e. to link to the front page.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <ul> <li>Go to a custom block edit page</li> <li>Click "Back to site"</li> </ul> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>The breadcrumb.theme would handle custom blocks in the same way as media (when viewing stand-alone was disabled).</p> <pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Custom block handling (a custom block cannot be viewed standalone).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($entity_id === 'block_content') {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $url = Url::fromRoute('&lt;front&gt;');<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</pre>
issue