function drupalforfirebug_array_row_build in Drupal For Firebug 5
Same name and namespace in other branches
- 6 drupalforfirebug.module \drupalforfirebug_array_row_build()
- 7.2 drupalforfirebug.module \drupalforfirebug_array_row_build()
- 7 drupalforfirebug.module \drupalforfirebug_array_row_build()
Specialized Function to Return an Array Row
1 call to drupalforfirebug_array_row_build()
- drupalforfirebug_array_highlight_code in ./
drupalforfirebug.module - Specialized Array Data Style Function
File
- ./
drupalforfirebug.module, line 269
Code
function drupalforfirebug_array_row_build($key, $value, $style, $depth) {
for ($x = 0; $x <= $depth; $x++) {
$spacing .= ' ';
}
switch ($style) {
case 'ADDED':
$color = '<font color="green">';
$colorend = '</font>';
break;
case 'REMOVED':
$color = '<font color="red">';
$colorend = '</font>';
break;
case 'SAME':
$color = '<font color="black">';
$colorend = '</font>';
break;
case 'DIFFERENT':
$color = '<font color="orange">';
$colorend = '</font>';
break;
default:
// suppose to be for objects
$color = '<font color="grey">' . $style;
$colorend = '</font>';
break;
}
if (is_array($value) || is_object($value)) {
if ($style == 'DIFFERENT') {
// do not highlight if contained item is just changed.
$color = '';
$colorend = '';
}
if (is_array($value)) {
$output .= "<div>{$spacing} {$color} [{$key}] => array ( {$colorend} </div>";
}
else {
$output .= "<div>{$spacing} <font color=grey> [{$key}] => stdClass ({$colorend} </div>";
}
$output .= drupalforfirebug_array_highlight_code($value, $depth + 1);
$output .= "<div>{$spacing} {$color} ) {$colorend} </div>";
}
else {
if (isset($key) || isset($value)) {
$output .= "<div>{$spacing} {$color} [{$key}] => [" . check_plain($value) . "] {$colorend} </div>";
}
}
return $output;
}