function freelinking_get_freelink in Freelinking 6.3
Same name and namespace in other branches
- 7.3 freelinking.utilities.inc \freelinking_get_freelink()
Process the target text into a link with the specified plugin.
Parameters
$plugin: The name of the plugin to be used to render the link.
$target: The target text extracted from the freelink. Array.
$format: The format id currently invoking the Freelinking filter. Might be used in the future to tweak plugin behavior.
$rendered: Boolean value. If true, link will be returned as rendered HTML. If false, link will be returned as arguments for l().
Return value
An array as per the arguments of l() or a string of HTML markup.
See also
l()
1 call to freelinking_get_freelink()
- freelinking_filter in ./
freelinking.module - Implementation of hook_filter().
File
- ./
freelinking.utilities.inc, line 32 - Freelinking 3 Utilities
Code
function freelinking_get_freelink($plugin, $target, $format = 'all', $rendered = TRUE) {
$plugins = freelinking_get_plugins($format);
$link = _freelinking_build_freelink($plugins, $plugin, $target);
if (!$rendered || !is_array($link)) {
return $link;
}
if (isset($link['failover'])) {
if ($link['failover'] == 'error') {
return theme('freelink_error', $plugin, $link['message']);
}
elseif ($link['failover'] == 'none') {
return FALSE;
}
}
if (isset($link['error'])) {
return theme('freelink_error', array(
'plugin' => $plugin,
'message' => $link['error'],
));
}
if (function_exists('theme_freelink_' . $plugin)) {
return theme('freelink_' . $plugin, $link);
}
return theme('freelink', $plugin, $link);
}