Skip to content

Commit

Permalink
Merge branch 'craft-4' of https://github.com/verbb/navigation into cr…
Browse files Browse the repository at this point in the history
…aft-5

# Conflicts:
#	CHANGELOG.md
#	composer.json
  • Loading branch information
engram-design committed Jul 21, 2024
2 parents 04b255e + 278fd2c commit a13237f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
- Now requires Craft `5.0.0+`.
- Update site menu to use breadcrumb.

## 2.1.0 - 2024-07-21

### Changed
- Now requires Craft 4.5.0+.

### Fixed
- Fix an error when moving nodes between levels with level-limits set.

## 2.0.28 - 2024-06-16

### Changed
Expand Down
4 changes: 2 additions & 2 deletions src/models/Nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function getHasMultiSiteNodes(): bool
);
}

public function isOverMaxNodes($node): bool
public function isOverMaxNodes(Node $node): bool
{
if ($this->maxNodes) {
$nodesService = Navigation::$plugin->getNodes();
Expand All @@ -165,7 +165,7 @@ public function isOverMaxNodes($node): bool
return false;
}

public function isOverMaxLevel($node): bool
public function isOverMaxLevel(Node $node): bool
{
if ($this->maxNodesSettings) {
foreach ($this->maxNodesSettings as $maxNodesSetting) {
Expand Down
4 changes: 4 additions & 0 deletions src/services/Nodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ public function onMoveElement(MoveElementEvent $event): void

$nav = $event->element->getNav();

// The element we've moving won't have its destination level set yet,
// so use the target element (where we're moving to) to deduce that.
$event->element->level = $event->getTargetElement()->level ?? $event->element->level;

if ($nav->maxNodesSettings) {
Navigation::$plugin->getNodes()->setTempNodes([$event->element]);

Expand Down

0 comments on commit a13237f

Please sign in to comment.