function profile2_diff_inline_form in Profile 2 7.2
Form builder: Inline diff controls.
1 string reference to 'profile2_diff_inline_form'
- profile2_diff_block_view in contrib/
profile2_diff.module - Implements hook_block_view().
File
- contrib/
profile2_diff.module, line 361 - Provides functionality to show a diff between two profile2 revisions.
Code
function profile2_diff_inline_form($form, $form_state, $profile, $old_vid, $revisions) {
$form = array();
$form['profile'] = array(
'#type' => 'value',
'#value' => $profile,
);
$form['revision'] = array(
'#type' => 'select',
'#options' => array(
0 => '< ' . t('No highlighting') . ' >',
),
'#default_value' => arg(2) === 'revisions' && arg(5) === $profile->vid ? $old_vid : 0,
'#ajax' => array(
'callback' => 'profile2_diff_inline_ajax',
'wrapper' => "diff-inline-{$profile->pid}",
'method' => 'replace',
),
);
foreach ($revisions as $revision) {
$form['revision']['#options'][$revision->vid] = t('@revision by @name', array(
'@revision' => format_date($revision->timestamp, 'short'),
'@name' => $revision->name,
));
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('View'),
'#submit' => array(
'profile2_diff_inline_form_submit',
),
'#attributes' => array(
'class' => array(
'diff-js-hidden',
),
),
);
return $form;
}