You are here

function service_links_render_some in Service links 7.2

Same name and namespace in other branches
  1. 6.2 service_links.module \service_links_render_some()

This function render only the services requested by their id.

Parameters

$service_ids: The list of requested services, can be just a string, for a single services, or an array of id, don't need enable them on the admin page.

$node: Contains the content structured as a node object. Use the node_load() function to build one or set NULL this variable to consider the current page.

$nodelink: (optional) It determines the kind of render. If TRUE the function return an array of items compatible with the standard Drupal link section. If FALSE return an array of HTML links. Default is FALSE.

$options: (optional) Can assume the value of a valid service style either an array containing the settings to override (look at _service_links_load_settings() for more details).

Return value

An array of HTML links if $nodelink = FALSE, an array of structured links to be themed with theme_links() if $nodelink = TRUE.

5 calls to service_links_render_some()
themename_preprocess in ./template.php
If something doesn't work well try this.
themename_preprocess_node in ./template.php
Example 2: Creating the variable '$twitter' for the template file 'node.tpl.php' containing the services specified by their ids (i.e. twitter).
theme_sld_single_image in plugins/service_links_displays.module
Apply the Image format to a single Service.
theme_sld_single_image_and_text in plugins/service_links_displays.module
Apply the Image and Text format to a single Service.
theme_sld_single_text in plugins/service_links_displays.module
Apply the Text format to a single Service.

File

./service_links.module, line 540
Adds social network links to the content.

Code

function service_links_render_some($service_ids, $node = NULL, $nodelink = FALSE, $options = NULL) {
  if (is_array($service_ids)) {
    $services = service_links_get_links($service_ids);
  }
  else {
    $services = service_links_get_links(array(
      $service_ids,
    ));
  }
  if (empty($services)) {
    return array();
  }
  $settings = _service_links_load_settings();
  if (isset($options)) {
    if (!is_array($options)) {
      $options = array(
        'style' => $options,
      );
    }
    $settings = array_merge($settings, $options);
  }
  _service_links_get_tags($node, $settings);
  $links = array();
  foreach ($services as $service_id => $service) {
    $links += _service_links_render($service_id, $service, $settings, $nodelink, $node);
  }
  return $links;
}