You are here

function globallink_menu_preview_content in GlobalLink Connect for Drupal 7.7

Helper function

1 string reference to 'globallink_menu_preview_content'
globallink_menu_preview in globallink_menu/globallink_menu_send.inc
Helper function

File

globallink_menu/globallink_menu_send.inc, line 530

Code

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