You are here

function profile2_diff_inline_show in Profile 2 7.2

Show the inline diff of a given profile object v. the profile with $old_vid. If $old_vid = 0 returns the normally rendered content of the profile object. If metadata is TRUE a header will be added with a legend explaining the color code. This function returns HTML code.

2 calls to profile2_diff_inline_show()
profile2_diff_entity_view_alter in contrib/profile2_diff.module
Implementation of hook_entity_view_alter().
profile2_diff_inline_ajax in contrib/profile2_diff.module
AJAX callback for rendering the inline diff of a user.

File

contrib/profile2_diff.pages.inc, line 278
Menu callbacks for hook_menu().

Code

function profile2_diff_inline_show($profile, $old_vid = 0, $metadata = TRUE) {
  $new_profile = $profile;
  $content = $new_profile
    ->buildContent();
  $new = drupal_render($content);
  module_load_include('inc', 'diff', 'diff.pages');
  if ($old_vid) {
    $old_profile = profile2_load($profile->pid, $old_vid);
    $content = $old_profile
      ->buildContent();
    $old = drupal_render($content);
    $output = $metadata ? theme('profile2_diff_inline_metadata', array(
      'profile' => $new_profile,
    )) : '';
    $output .= diff_get_inline($old, $new);
    return $output;
  }
  return $new;
}