Lass Menüeinträge auf eine Sprungmarke der Zielseite zeigen

Zweiter Schritt in „Ziel ändern“, neue Spalte navigation_items.anchor (nullable, abwärtskompatibel).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-27 07:05:22 +01:00
1 parent 6b43fbb7d1
commit 04a9a4f83f
5 files changed
+274 -7

No files matched your search

+5 -1
View File
@@ -2,6 +2,7 @@
namespace App\Domain\Cms;
use App\Domain\Cms\Sections\PageSections;
use App\Domain\Cms\Widgets\Support\SafeUrl;
use App\Domain\Commerce\Shop;
use Illuminate\Database\Eloquent\Builder;
@@ -32,6 +33,7 @@ class NavigationItem extends Model
'label',
'page_id',
'url',
'anchor',
'placement',
'sort_order',
'is_visible',
@@ -86,7 +88,9 @@ public function href(): ?string
}
if ($this->page !== null) {
return $this->page->path === '/' ? url('/') : url($this->page->path);
$anchor = PageSections::cleanAnchor($this->anchor);
return ($this->page->path === '/' ? url('/') : url($this->page->path)).($anchor !== null ? '#'.$anchor : '');
}
if ($this->url === null || $this->url === '' || ! SafeUrl::isSafe($this->url)) {