function globallink_commerce_preview_content in GlobalLink Connect for Drupal 7.7
Helper function
1 string reference to 'globallink_commerce_preview_content'
- globallink_commerce_preview in globallink_commerce/
globallink_commerce_send.inc - Helper function
File
- globallink_commerce/
globallink_commerce_send.inc, line 417
Code
function globallink_commerce_preview_content() {
module_load_include('inc', 'globallink', 'globallink_commerce/globallink_commerce');
module_load_include('inc', 'globallink', 'globallink');
$id = arg(5);
$output = "";
$string = globallink_commerce_get_xml($id);
$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;
}