From 25bb280b9cac593f81feb41335b7ffccad71924b Mon Sep 17 00:00:00 2001 From: Thom Vrijmoed Date: Mon, 3 Feb 2020 11:10:10 +0100 Subject: [PATCH] Editing list items in a list propagate disabled --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/controllers/ListsController.php | 2 ++ src/elements/ListItem.php | 24 ++++++++++++------------ 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a15d848..87fb9bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.2.3 - 2020-02-03 +### Fixed +- Fixed a bug when editing list items in a list with propagate disabled + ## 1.2.2.1 - 2020-01-29 ### Fixed - Fixed a bug when selecting entries in multisite environment diff --git a/composer.json b/composer.json index 7dd5489..a4ca77e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "dutchheight/craft-navie", "description": "Navigation plugin for Craft CMS 3", "type": "craft-plugin", - "version": "1.2.2.1", + "version": "1.2.3", "keywords": [ "craft", "cms", diff --git a/src/controllers/ListsController.php b/src/controllers/ListsController.php index 3731780..7248961 100644 --- a/src/controllers/ListsController.php +++ b/src/controllers/ListsController.php @@ -217,6 +217,8 @@ public function actionEditListItem(string $listHandle = null, string $siteHandle 'listItem' => $listItem ]; + $siteHandle = $siteHandle ?? Craft::$app->getRequest()->getQueryParam('site', null); + if ($siteHandle !== null) { $variables['site'] = Craft::$app->getSites()->getSiteByHandle($siteHandle); diff --git a/src/elements/ListItem.php b/src/elements/ListItem.php index 3b3805f..55717c5 100644 --- a/src/elements/ListItem.php +++ b/src/elements/ListItem.php @@ -11,29 +11,29 @@ namespace dutchheight\navie\elements; -use dutchheight\navie\Navie; -use dutchheight\navie\elements\db\ListItemQuery; -use dutchheight\navie\models\ListModel; -use dutchheight\navie\records\ListItemRecord; - use Craft; use craft\base\Element; use craft\controllers\ElementIndexesController; use craft\db\Query; -use craft\elements\db\ElementQuery; -use craft\elements\db\ElementQueryInterface; -use craft\elements\actions\Edit; -use craft\elements\actions\SetStatus; + +use craft\elements\actions\DeepDuplicate; use craft\elements\actions\Delete; -use craft\elements\actions\NewChild; use craft\elements\actions\Duplicate; -use craft\elements\actions\DeepDuplicate; +use craft\elements\actions\Edit; +use craft\elements\actions\NewChild; +use craft\elements\actions\SetStatus; use craft\elements\Asset; use craft\elements\Category; +use craft\elements\db\ElementQuery; +use craft\elements\db\ElementQueryInterface; use craft\elements\Entry; use craft\helpers\ArrayHelper; use craft\helpers\UrlHelper; use craft\services\Elements; +use dutchheight\navie\elements\db\ListItemQuery; +use dutchheight\navie\models\ListModel; +use dutchheight\navie\Navie; +use dutchheight\navie\records\ListItemRecord; use yii\base\InvalidConfigException; class ListItem extends Element @@ -443,7 +443,7 @@ public function getElement() } if ($this->elementId !== null) { - return $this->_element = Craft::$app->elements->getElementById($this->elementId); + return $this->_element = Craft::$app->elements->getElementById($this->elementId, null, $this->siteId); } return null;