function gdpr_consent_agreement_revision_overview in General Data Protection Regulation 7
Generates an overview table of older revisions of a Consent Agreement.
Parameters
GdprConsentAgreement $agreement: A consent agreement entity.
Return value
array An array as expected by drupal_render().
1 string reference to 'gdpr_consent_agreement_revision_overview'
- gdpr_consent_menu in modules/
gdpr_consent/ gdpr_consent.module - Implements hook_menu().
File
- modules/
gdpr_consent/ includes/ gdpr_consent.admin.inc, line 104 - Admin pages file for the GDPR Consent module.
Code
function gdpr_consent_agreement_revision_overview(GdprConsentAgreement $agreement) {
drupal_set_title(t('Revisions for @title', array(
'@title' => $agreement->title,
)));
$header = array(
t('Revision'),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
$revisions = gdpr_consent_revision_list($agreement);
$rows = array();
foreach ($revisions as $revision) {
$row = array();
$operations = array();
if ($revision->current_revision > 0) {
$row[] = array(
'data' => t('!date by !username', array(
'!date' => l(format_date($revision->timestamp, 'short'), "admin/config/gdpr/agreements/{$agreement->id}"),
'!username' => theme('username', array(
'account' => $revision,
)),
)) . ($revision->log != '' ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
'class' => array(
'revision-current',
),
);
$operations[] = array(
'data' => drupal_placeholder(t('current revision')),
'class' => array(
'revision-current',
),
'colspan' => 2,
);
}
else {
$row[] = t('!date by !username', array(
'!date' => l(format_date($revision->timestamp, 'short'), "admin/config/gdpr/agreements/{$agreement->id}/revisions/{$revision->revision_id}/view"),
'!username' => theme('username', array(
'account' => $revision,
)),
)) . ($revision->log != '' ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
$operations[] = l(t('revert'), "admin/config/gdpr/agreements/{$agreement->id}/revisions/{$revision->revision_id}/revert");
$operations[] = l(t('delete'), "admin/config/gdpr/agreements/{$agreement->id}/revisions/{$revision->revision_id}/delete");
}
$rows[] = array_merge($row, $operations);
}
$build['gdpr_consent_revisions_table'] = array(
'#theme' => 'table',
'#rows' => $rows,
'#header' => $header,
);
return $build;
}