You are here

function dsField::getContent in Display Suite 6.3

Get content for use in a field.

This will check an array of content values for a matching key and use its value as the field's content.

Parameters

stdClass $item: the item to set content for

array $content_vars (optional): the $vars array, or an array containing possible values

string $vars_key : the key within $content_vars to retrieve

Return value

the content value as a string, or FALSE if none was found

File

plugins/ds_field/basic.inc, line 205

Class

dsField

Code

function getContent($content_vars = array(), $vars_key = NULL) {

  // If content has been prerendered by ds_build_fields_and_objects use that
  if (!empty($this->content)) {
    return $this->content;
  }
  if (empty($vars_key)) {
    $vars_key = $this->key;
  }

  // If content has been rendered by another source (e.g. CCK) use that
  if (!empty($content_vars)) {
    if (isset($content_vars[$vars_key . '_rendered'])) {
      $this->content = $content_vars[$vars_key . '_rendered'];
    }
    elseif (isset($content_vars[$vars_key])) {
      $this->content = $content_vars[$vars_key];
    }
  }
  if (!empty($this->content)) {
    return $this->content;
  }
  return FALSE;
}