You are here

function ds_render_item in Display Suite 6.2

Return a value for a field or group.

Parameters

array $item: The item to render. The item requires a 'content' key.

Return value

string A rendered item, or FALSE if no content was found

3 calls to ds_render_item()
ds_render_content in ./ds.module
Render content for an object.
ds_render_group in ./ds.module
Return a rendered fieldset group.
ds_render_multigroup in ./ds.module
Return a rendered multigroup group.

File

./ds.module, line 810
Core functions for the Display Suite module.

Code

function ds_render_item($item) {
  $content = FALSE;
  switch ($item['pipeline']) {

    // Render the content using Drupal's default render function.
    case DS_RENDER_DRUPAL:
      $content = drupal_render($item['vars']);
      break;

    // This is a non-DS field and has done its own rendering
    // e.g. CCK.
    case DS_RENDER_NON_DS:
      if (!empty($item['content'])) {
        $content = $item['content'];
      }
      break;

    // Use ds's built-in rendering.
    default:
    case DS_RENDER_DEFAULT:
      if (!empty($item['content'])) {

        // Tabs must use the ds_tabs themeing function.
        if (isset($item['tab'])) {
          $item['theme'] = 'ds_tabs';
        }
        elseif (empty($item['theme'])) {
          $item['theme'] = DS_DEFAULT_THEME_FIELD;
        }
        $content = theme($item['theme'], $item);
      }
      break;
  }

  // theme() can return anything, but we only want to return content where
  // there is 1 or more characters.
  if (isset($content) && strlen($content) > 0) {
    return $content;
  }
  return FALSE;
}