You are here

function service_links_service_links_content_type_render in Service links 7.2

Output function for the 'service_links' content type.

1 string reference to 'service_links_service_links_content_type_render'
service_links.inc in plugins/content_types/service_links.inc
Content type enables user to place the selected service links

File

plugins/content_types/service_links.inc, line 24
Content type enables user to place the selected service links

Code

function service_links_service_links_content_type_render($subtype, $conf, $panel_args, &$context) {
  $content = NULL;
  $node = menu_get_object('node');
  $style = $conf['service_links_block_style'];
  $panel_services = array();
  $settings = _service_links_load_settings();
  $services = service_links_get_links($settings['link_show']);
  foreach ($services as $service_id => $service) {
    if (isset($conf[$service_id]) && $conf[$service_id]) {
      $panel_services[$service_id] = $service;
    }
  }
  if (isset($node)) {
    switch ($conf['service_links_style']) {
      case 'service_links':
        $content = theme('service_links_block_format', array(
          'items' => panel_service_links_render($node, FALSE, $style, $panel_services),
          'style' => $style,
        ));
        break;
      case 'service_links_fisheye':
        $content = theme('service_links_fisheye_format', array(
          'items' => panel_service_links_render($node, FALSE, SERVICE_LINKS_STYLE_FISHEYE, $panel_services),
        ));
        break;
    }
  }
  elseif (!isset($node)) {
    switch ($conf['service_links_style']) {
      case 'service_links':
        $options = array(
          'style' => $style,
          'link_to_front' => variable_get('service_links_block_not_node_front', FALSE),
        );
        $content = theme('service_links_block_format', array(
          'items' => panel_service_links_render(NULL, FALSE, $options, $panel_services),
          'style' => $style,
        ));
        break;
      case 'service_links_fisheye':
        $content = theme('service_links_fisheye_format', array(
          'items' => panel_service_links_render(NULL, FALSE, SERVICE_LINKS_STYLE_FISHEYE, $panel_services),
        ));
        break;
    }
  }

  // Build the content type block.
  $block = new stdClass();
  $block->content = $content;
  return $block;
}