You are here

function ds_field_format_content in Display Suite 6.2

Format content for use in an item.

1 call to ds_field_format_content()
ds_build_field in ./ds.module
Build an individual field value.

File

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

Code

function ds_field_format_content($field) {
  $content = NULL;
  switch ($field['pipeline']) {
    case DS_RENDER_DRUPAL:

      // Does nothing, as drupal_render will take care of the field later.
      break;
    case DS_RENDER_NON_DS:

      // Does nothing, because we are ignoring it.
      break;
    default:
    case DS_RENDER_DEFAULT:
      if (isset($field['formatter']) || isset($field['function'])) {

        // Load includes.
        if (isset($field['file'])) {
          include_once $field['file'];
        }

        // If its a function, call it.
        if (isset($field['function']) && !empty($field['function'])) {
          if (function_exists($field['function'])) {
            $content = call_user_func($field['function'], $field);
          }
        }
        else {
          $content = theme($field['formatter'], $field);
        }
      }
      break;
  }
  return $content;
}