Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion fruitlinkit/fieldtypes/FruitLinkItFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions fruitlinkit/models/FruitLinkIt_LinkModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down