You are here

function title_field_text_with_summary_sync_get in Title 7

Sync callback for the text with summary field type.

File

./title.core.inc, line 172
Provide field replacement information.

Code

function title_field_text_with_summary_sync_get($entity_type, $entity, $legacy_field, $info, $langcode) {
  $value = NULL;
  $format = NULL;
  $info += array(
    'additional keys' => array(
      'format' => 'format',
    ),
  );
  $format_key = $info['additional keys']['format'];
  $field_name = $info['field']['field_name'];

  // Return values only if there is any available to process for the current
  // language.
  if (!empty($entity->{$field_name}[$langcode]) && is_array($entity->{$field_name}[$langcode])) {
    $item = $entity->{$field_name}[$langcode][0] + array(
      'value' => NULL,
      'format' => NULL,
    );
    $value = $item['value'];
    $format = $item['format'];
  }
  return array(
    $legacy_field => $value,
    $format_key => $format,
  );
}