You are here

function globallink_beans_preview_content in GlobalLink Connect for Drupal 7.7

Helper function

1 string reference to 'globallink_beans_preview_content'
globallink_beans_preview in globallink_beans/globallink_beans_send.inc
Helper function

File

globallink_beans/globallink_beans_send.inc, line 426

Code

function globallink_beans_preview_content() {
  module_load_include('inc', 'globallink', 'globallink_beans/globallink_beans');
  module_load_include('inc', 'globallink', 'globallink');
  $id = arg(5);
  $output = "";
  $string = globallink_beans_get_xml($id, 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_name;
      $output .= "<tr><td><strong>" . ucfirst($label) . "</strong></td><td>" . $value . "</td></tr>";
    }
  }
  $output .= "</table>";
  $form['preview'] = array(
    '#markup' => $output,
  );
  return $form;
}