You are here

function faqfield_tmgmt_source_translation_structure in FAQ Field 7

Implements hook_tmgmt_source_translation_structure().

File

./faqfield.module, line 696
FAQ Field Provides a field for frequently asked questions.

Code

function faqfield_tmgmt_source_translation_structure($entity_type, $entity, $field, $instance, $langcode, $items) {
  $structure = array();
  if (!empty($items)) {
    $structure['#label'] = check_plain($instance['label']);
    foreach ($items as $delta => $value) {
      $structure[$delta]['#label'] = t('Delta #@delta', array(
        '@delta' => $delta,
      ));
      $structure[$delta]['question'] = array(
        '#label' => check_plain($field['settings']['advanced']['question_title']),
        '#text' => $value['question'],
        '#translate' => TRUE,
      );
      $structure[$delta]['answer_format'] = array(
        '#label' => '',
        '#text' => $value['answer_format'],
        '#translate' => FALSE,
      );
      $structure[$delta]['answer'] = array(
        '#label' => check_plain($field['settings']['advanced']['answer_title']),
        '#text' => $value['answer'],
        '#translate' => TRUE,
      );
    }
  }
  return $structure;
}