You are here

function drupalforfirebug_array_highlight_code in Drupal For Firebug 5

Same name and namespace in other branches
  1. 6 drupalforfirebug.module \drupalforfirebug_array_highlight_code()
  2. 7.2 drupalforfirebug.module \drupalforfirebug_array_highlight_code()
  3. 7 drupalforfirebug.module \drupalforfirebug_array_highlight_code()

Specialized Array Data Style Function

2 calls to drupalforfirebug_array_highlight_code()
drupalforfirebug_array_compare in ./drupalforfirebug.module
Generalized Array Comparision Function
drupalforfirebug_array_row_build in ./drupalforfirebug.module
Specialized Function to Return an Array Row

File

./drupalforfirebug.module, line 318

Code

function drupalforfirebug_array_highlight_code($data, $depth = 0) {

  // Smartly Handling Recursion for Objects
  if (is_object($data)) {
    $data = (array) $data;
    static $refChain = array();
    foreach ($refChain as $refVal) {
      if ($refVal === $data) {
        $data = array(
          '**Recursion Detected**',
        );
      }
    }
    array_push($refChain, $data);
  }
  $output = '';
  foreach ($data as $key => $value) {
    if ((string) $key != '#firebug_style') {

      // make sure to allow for 0 items to come through
      $output .= drupalforfirebug_array_row_build($key, $value, $data['#firebug_style'][$key], $depth);
    }
  }
  return $output;
}