From b738a2fd7c9413570dfc7c139812b3dac0814d48 Mon Sep 17 00:00:00 2001 From: John D Wells Date: Mon, 20 Nov 2017 09:49:10 +0000 Subject: [PATCH 1/2] Ensure the type is still available. --- fruitlinkit/fieldtypes/FruitLinkItFieldType.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fruitlinkit/fieldtypes/FruitLinkItFieldType.php b/fruitlinkit/fieldtypes/FruitLinkItFieldType.php index 8ba06b1..fc503cb 100644 --- a/fruitlinkit/fieldtypes/FruitLinkItFieldType.php +++ b/fruitlinkit/fieldtypes/FruitLinkItFieldType.php @@ -44,7 +44,11 @@ public function getInputHtml($name, $value) { foreach($settings['types'] as $type) { - $types[$type] = $availableTypes[$type]; + // Ensure the type is still available + if(array_key_exists($type, $availableTypes)) + { + $types[$type] = $availableTypes[$type]; + } } } else From 105ccaa70961ebbad106cb75a7b6af17602796f0 Mon Sep 17 00:00:00 2001 From: John D Wells Date: Mon, 20 Nov 2017 18:07:38 +0000 Subject: [PATCH 2/2] Restore FruitLinkIt_LinkModel::getThirdPartyElementData(). --- fruitlinkit/models/FruitLinkIt_LinkModel.php | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/fruitlinkit/models/FruitLinkIt_LinkModel.php b/fruitlinkit/models/FruitLinkIt_LinkModel.php index d59f47c..2e49b72 100644 --- a/fruitlinkit/models/FruitLinkIt_LinkModel.php +++ b/fruitlinkit/models/FruitLinkIt_LinkModel.php @@ -291,6 +291,32 @@ public function getProduct() return $this->_product; } + public function getThirdPartyElementData($type) + { + if(!isset($this->_thirdPartyTypes[$type]) || !$this->_thirdPartyTypes[$type]) + { + $id = is_array($this->value) ? $this->value[0] : false; + + if ($id) + { + + // Allow plugins to define their own url and text data + $allPluginElements = craft()->plugins->call('linkit_getElementData', array($type, $id)); + + foreach ($allPluginElements as $pluginElement) + { + if ($pluginElement) + { + $this->_thirdPartyTypes[$type] = $pluginElement; + } + } + + } + + } + return isset($this->_thirdPartyTypes[$type]) ? $this->_thirdPartyTypes[$type] : null; + } + public function validate($attributes = null, $clearErrors = true) {