Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Oct 28, 2022
1 parent 53b17b9 commit e319f22
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/services/Navs.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,10 @@ public function handleChangedNav(ConfigEvent $event): void
$navRecord->maxNodes = $data['maxNodes'] ?? '';
$navRecord->sortOrder = $data['sortOrder'];
$navRecord->defaultPlacement = $data['defaultPlacement'] ?? NavModel::DEFAULT_PLACEMENT_END;
$navRecord->permissions = $data['permissions'] ?? [];

$schemaVersion = Craft::$app->getProjectConfig()->get('plugins.navigation.schemaVersion', true);

if (version_compare($schemaVersion, '2.0.2', '>=')) {
$navRecord->permissions = $data['permissions'] ?? [];
}

if (version_compare($schemaVersion, '2.0.5', '>=')) {
$navRecord->propagationMethod = $data['propagationMethod'] ?? NavModel::PROPAGATION_METHOD_ALL;
}
Expand Down Expand Up @@ -700,6 +697,7 @@ private function _createNavQuery(): Query
'navs.sortOrder',
'navs.maxNodes',
'navs.defaultPlacement',
'navs.permissions',
'navs.uid',
'structures.maxLevels',
])
Expand All @@ -714,10 +712,6 @@ private function _createNavQuery(): Query

$schemaVersion = Craft::$app->getProjectConfig()->get('plugins.navigation.schemaVersion', true);

if (version_compare($schemaVersion, '2.0.2', '>=')) {
$query->addSelect('navs.permissions');
}

if (version_compare($schemaVersion, '2.0.5', '>=')) {
$query->addSelect('navs.propagationMethod');
}
Expand Down

0 comments on commit e319f22

Please sign in to comment.