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 // =========================================================================