function drupalforfirebug_array_row_build in Drupal For Firebug 7.2
Same name and namespace in other branches
- 5 drupalforfirebug.module \drupalforfirebug_array_row_build()
- 6 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 420
Code
function drupalforfirebug_array_row_build($key, $value, $style, $depth) {
$spacing = '';
for ($x = 0; $x <= $depth; $x++) {
$spacing .= ' ';
}
switch ($style) {
case 'ADDED':
$color = '<span style="color: green;">';
$colorend = '</span>';
break;
case 'REMOVED':
$color = '<span style="color: red;">';
$colorend = '</span>';
break;
case 'SAME':
$color = '<span style="color: black;">';
$colorend = '</span>';
break;
case 'DIFFERENT':
$color = '<span style="color: orange;">';
$colorend = '</span>';
break;
default:
// suppose to be for objects
$color = '<span style="color: grey;">' . $style;
$colorend = '</span>';
break;
}
$output = '';
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 . '<span style="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)) {
if (is_resource($value)) {
$output .= "<div>{$spacing} {$color} [{$key}] => RESOURCE {$colorend} </div>";
}
else {
$output .= "<div>{$spacing} {$color} [{$key}] => [" . check_plain($value) . "] {$colorend} </div>";
}
}
}
return $output;
}