function diff_get_rows in Diff 7.3
Same name and namespace in other branches
- 6.2 diff.module \diff_get_rows()
- 7.2 diff.module \diff_get_rows()
Render the table rows for theme('table').
Parameters
string $a: The source string to compare from.
string $b: The target string to compare to.
bool $show_header: Display diff context headers. For example, "Line x".
array $line_stats: This structure tracks line numbers across multiple calls to DiffFormatter.
Return value
array Array of rows usable with theme('table').
1 call to diff_get_rows()
- diff_entity_body_rows in ./
diff.pages.inc - Creates an array of rows which represent the difference between two entities.
File
- ./
diff.module, line 564 - Provides functionality to show a diff between two node revisions.
Code
function diff_get_rows($a, $b, $show_header = FALSE, &$line_stats = NULL) {
$a = is_array($a) ? $a : explode("\n", $a);
$b = is_array($b) ? $b : explode("\n", $b);
if (!isset($line_stats)) {
$line_stats = array(
'counter' => array(
'x' => 0,
'y' => 0,
),
'offset' => array(
'x' => 0,
'y' => 0,
),
);
}
$formatter = new DrupalDiffFormatter();
// Header is the line counter.
$formatter->show_header = $show_header;
$formatter->line_stats =& $line_stats;
$diff = new Diff($a, $b);
return $formatter
->format($diff);
}