From fa49e6760a02c9087e77729c4a722b1d37245452 Mon Sep 17 00:00:00 2001 From: christianruhstaller Date: Mon, 27 Feb 2017 17:59:38 +0100 Subject: [PATCH] fix: use locale for entry select If you are in a multi-locale env and you have disabled entries in your main locale then you can't select entries in different locales because they do not get shown in the modal dialog. --- fruitlinkit/fieldtypes/FruitLinkItFieldType.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fruitlinkit/fieldtypes/FruitLinkItFieldType.php b/fruitlinkit/fieldtypes/FruitLinkItFieldType.php index 058b7d9..e779f92 100644 --- a/fruitlinkit/fieldtypes/FruitLinkItFieldType.php +++ b/fruitlinkit/fieldtypes/FruitLinkItFieldType.php @@ -60,6 +60,7 @@ public function getInputHtml($name, $value) 'sources' => $settings->entrySources, 'criteria' => array( 'status' => null, + 'locale' => $this->getTargetLocale(), ), 'sourceElementId' => ( isset($this->element->id) ? $this->element->id : null ), 'limit' => 1, @@ -185,7 +186,19 @@ protected function getSettingsModel() { return new FruitLinkIt_LinkSettingsModel(); } + + protected function getTargetLocale() + { + if (craft()->isLocalized()) + { + if (isset($this->element)) + { + return $this->element->locale; + } + } + return craft()->getLanguage(); + } // Private Methods // =========================================================================