You are here

function globallink_file_entity_preview_content in GlobalLink Connect for Drupal 7.7

Helper function

1 string reference to 'globallink_file_entity_preview_content'
globallink_file_entity_preview in globallink_file_entity/globallink_file_entity_send.inc
Helper function

File

globallink_file_entity/globallink_file_entity_send.inc, line 361

Code

function globallink_file_entity_preview_content() {
  module_load_include('inc', 'globallink', 'globallink_file_entity/globallink_file_entity');
  module_load_include('inc', 'globallink', 'globallink');
  $fid = arg(5);
  $output = "";
  $string = globallink_get_file_entity_xml($fid, NULL);
  $xml = new SimpleXMLElement($string);
  $elem = $xml->field
    ->count();
  $output .= "<table><tr><th>Fields</th><th>Source Contents</th></tr>";
  if ($elem > 0) {
    foreach ($xml->field as $element) {
      $tag = $element
        ->getName();
      $value = (string) $element;
      $label = (string) $element
        ->attributes()->field;
      $output .= "<tr><td><strong>" . ucfirst($label) . "</strong></td><td>" . $value . "</td></tr>";
    }
  }
  $output .= "</table>";
  $form['preview'] = array(
    '#markup' => $output,
  );
  return $form;
}