You are here

function _messaging_devel_format_object in Messaging 7

Format objects/array in logs

1 call to _messaging_devel_format_object()
_messaging_devel_format_log in messaging_devel/messaging_devel.module
Format complex log as collapsible fieldset

File

messaging_devel/messaging_devel.module, line 294
Simple messaging using html page. Messaging method plug-in

Code

function _messaging_devel_format_object($data, $name) {
  $rows = array();
  foreach ($data as $key => $value) {
    if (is_numeric($value) || is_string($value)) {

      // Make line endings visible
      $content = str_replace("\n", '\\n<br />', check_plain($value));
    }
    elseif (is_object($value) || is_array($value)) {
      $content = _messaging_devel_format_object($value, $key);
    }
    if (isset($content)) {
      $rows[] = array(
        check_plain($key),
        $content,
      );
    }
  }
  $header = array(
    check_plain($name),
    is_object($data) ? t('Object') : t('Array'),
  );
  return theme('table', $header, $rows);
}