function _service_links_render in Service links 6.2
Same name and namespace in other branches
- 7.2 service_links.module \_service_links_render()
The common render function used privately.
2 calls to _service_links_render()
- service_links_render in ./
service_links.module - Function that render all the selected services.
- service_links_render_some in ./
service_links.module - This function render only the services requested by their id.
File
- ./
service_links.module, line 572 - Adds social network links to the content.
Code
function _service_links_render($service_id, $service, $settings, $nodelink, $node) {
if (isset($service['preset'])) {
if (function_exists($function = $service['preset'])) {
$function($service, $settings, $node);
}
}
// With Clean Urls on this tag should be filled before the split otherwise will be lost.
$service['link'] = str_replace('<front-page>', $settings['subst']['front-page'], $service['link']);
$service['url'] = preg_split('/\\?/', $service['link']);
$subst_id = isset($service['url'][1]) ? 1 : 0;
$service['url'][$subst_id] = str_replace($settings['tag'], $settings['subst'], $service['url'][$subst_id]);
$service['attributes']['title'] = t($service['description']);
$class = str_replace(array(
'][',
'_',
' ',
), '-', 'service_links-' . $service_id);
$service['attributes']['class'] = isset($service['attributes']['class']) ? $service['attributes']['class'] . " " . $class : $class;
$service['attributes'] += $settings['attributes'];
$service['icon'] = isset($service['icon']) ? $service['icon'] : "{$service_id}.png";
$service_id = str_replace('_', '-', 'service_links_' . $service_id);
// Check if a predefined style should be imposed.
if (empty($service['style'])) {
$service['style'] = $settings['style'];
}
// Add the related JavaScript and CSS.
if (isset($service['javascript'])) {
_service_links_add_js($service['javascript']);
}
if (isset($service['css'])) {
drupal_add_css(service_links_expand_path($service['css'], 'css'));
}
// Invoke callback function.
if (isset($service['callback'])) {
if (function_exists($function = $service['callback'])) {
$function($service, $settings['subst']);
}
}
// Create the HTML.
$link = theme('service_links_build_link', t($service['name']), $service['url'], $service['icon'], $nodelink, $service['style'], $service['attributes']);
return array(
$service_id => $link,
);
}