You are here

function diff_markdown_state in Diff 7.3

Helper function to render plain states from the corresponding raw state.

Parameters

array $diff: The Diff Engine output array.

string $state: The state to markdown.

1 call to diff_markdown_state()
diff_compare_entities in ./diff.pages.inc
Generic callback to compare two entities.

File

./diff.pages.inc, line 525
Menu callbacks for hook_menu().

Code

function diff_markdown_state(&$diff, $state) {
  list($plain_old, $plain_new) = diff_extract_state($diff, $state . '_plain');
  list($old, $new) = diff_extract_state($diff, $state);
  $markdown = FALSE;
  if (isset($diff['#settings']) && !empty($diff['#settings']['markdown'])) {
    if (function_exists($diff['#settings']['markdown'])) {
      $markdown = $diff['#settings']['markdown'];
    }
  }
  if (!isset($plain_old) && isset($old)) {
    $diff['#states'][$state . '_plain']['#old'] = _diff_apply_markdown($markdown, $old);
  }
  if (!isset($plain_new) && isset($new)) {
    $diff['#states'][$state . '_plain']['#new'] = _diff_apply_markdown($markdown, $new);
  }
}