diff options
| author | polo <ordipolo@gmx.fr> | 2025-04-13 14:16:51 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-04-13 14:16:51 +0200 |
| commit | ca3949aca0c7c1af476c8eec93b4920d5aff21ec (patch) | |
| tree | 5119d69995323c607fb81cdf19c7e271cd0f3ef6 /src/view/NavBuilder.php | |
| parent | 75f2c543e7fe45c1a3dcea842650a5d13a0235f0 (diff) | |
| download | cms-ca3949aca0c7c1af476c8eec93b4920d5aff21ec.tar.gz cms-ca3949aca0c7c1af476c8eec93b4920d5aff21ec.tar.bz2 cms-ca3949aca0c7c1af476c8eec93b4920d5aff21ec.zip | |
erreur de balises
Diffstat (limited to 'src/view/NavBuilder.php')
| -rw-r--r-- | src/view/NavBuilder.php | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/view/NavBuilder.php b/src/view/NavBuilder.php index 2ef6bc8..603fcfa 100644 --- a/src/view/NavBuilder.php +++ b/src/view/NavBuilder.php | |||
| @@ -24,32 +24,30 @@ class NavBuilder extends AbstractBuilder | |||
| 24 | { | 24 | { |
| 25 | $li_class = ''; | 25 | $li_class = ''; |
| 26 | if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ | 26 | if(isset($current[$level]) && $data->getEndOfPath() === $current[$level]->getEndOfPath()){ |
| 27 | $li_class = 'current'; | 27 | $li_class = 'current '; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | $link = ''; | ||
| 30 | if($data->isReachable()) | 31 | if($data->isReachable()) |
| 31 | { | 32 | { |
| 32 | $target = ''; | ||
| 33 | if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site | 33 | if(str_starts_with($data->getEndOfPath(), 'http')) // lien vers autre site |
| 34 | { | 34 | { |
| 35 | $link = $data->getEndOfPath(); // $link = chaine | 35 | $link .= '<a href="' . $data->getEndOfPath() . '" target="_blank">'; |
| 36 | $target = ' target="_blank"'; | ||
| 37 | } | 36 | } |
| 38 | elseif($data->getEndOfPath() != '') // lien relatif | 37 | elseif($data->getEndOfPath() != '') // lien relatif |
| 39 | { | 38 | { |
| 40 | $link = new URL(['page' => $data->getPagePath()]); // $link = objet | 39 | $link .= '<a href="' . new URL(['page' => $data->getPagePath()]) . '">'; |
| 41 | } | 40 | } |
| 42 | $nav_html .= '<a href="' . $link . '"' . $target . '>'; | ||
| 43 | } | 41 | } |
| 44 | else{ | 42 | else{ |
| 45 | $nav_html .= '<a>'; | 43 | $link .= '<a>'; |
| 46 | } | 44 | } |
| 47 | 45 | ||
| 48 | if(count($data->getChildren()) > 0) // titre de catégorie | 46 | if(count($data->getChildren()) > 0) // titre de catégorie |
| 49 | { | 47 | { |
| 50 | $li_class = $data->getParent() == null ? 'drop-down' : 'drop-right'; | 48 | $li_class .= $data->getParent() == null ? 'drop-down' : 'drop-right'; |
| 51 | 49 | ||
| 52 | $nav_html .= '<li class="'. $li_class . '"><p>' . $data->getPageName() . '</p><ul class="sub-menu">' . "\n"; | 50 | $nav_html .= '<li class="'. $li_class . '">' . $link . '<p>' . $data->getPageName() . '</p></a><ul class="sub-menu">' . "\n"; |
| 53 | $level++; | 51 | $level++; |
| 54 | $nav_html .= $this->navMainHTML($data, $current); | 52 | $nav_html .= $this->navMainHTML($data, $current); |
| 55 | $level--; | 53 | $level--; |
| @@ -57,10 +55,8 @@ class NavBuilder extends AbstractBuilder | |||
| 57 | } | 55 | } |
| 58 | else | 56 | else |
| 59 | { | 57 | { |
| 60 | $nav_html .= '<li class="'. $li_class . '"><p>' . $data->getPageName() . '</p></li>' . "\n"; | 58 | $nav_html .= '<li class="'. $li_class . '">' . $link . '<p>' . $data->getPageName() . '</p></a></li>' . "\n"; |
| 61 | } | 59 | } |
| 62 | |||
| 63 | $nav_html .= "</a>\n"; | ||
| 64 | } | 60 | } |
| 65 | return $nav_html; | 61 | return $nav_html; |
| 66 | } | 62 | } |
