public function DataPolicy::revisionsOverviewPage in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 8.2 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 8.3 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 8.4 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 8.6 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 8.7 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 8.8 modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 10.0.x modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
- 10.1.x modules/custom/social_gdpr/src/Controller/DataPolicy.php \Drupal\social_gdpr\Controller\DataPolicy::revisionsOverviewPage()
Generates an overview table of older revisions of a Data policy.
Return value
array An array as expected by drupal_render().
Overrides DataPolicy::revisionsOverviewPage
1 string reference to 'DataPolicy::revisionsOverviewPage'
- social_gdpr.routing.yml in modules/
custom/ social_gdpr/ social_gdpr.routing.yml - modules/custom/social_gdpr/social_gdpr.routing.yml
File
- modules/
custom/ social_gdpr/ src/ Controller/ DataPolicy.php, line 46
Class
- DataPolicy
- Class DataPolicy.
Namespace
Drupal\social_gdpr\ControllerCode
public function revisionsOverviewPage() {
$build = parent::revisionsOverviewPage();
$routes = [
'view' => 'social_gdpr.data_policy.revision',
'edit' => 'social_gdpr.data_policy.revision_edit',
'delete' => 'social_gdpr.data_policy.revision_delete',
];
foreach ($build['data_policy_revisions_table']['#rows'] as &$row) {
foreach ($row[1]['data']['#links'] as $operation => &$link) {
/** @var \Drupal\Core\Url $url */
$url =& $link['url'];
if ($operation == 'revert') {
if ($url
->getRouteName() == 'entity.data_policy.revision_revert') {
$route_name = 'social_gdpr.data_policy.revision_revert';
}
else {
$route_name = 'social_gdpr.data_policy.translation_revert';
}
$link['url'] = Url::fromRoute($route_name, $url
->getRouteParameters());
$link['attributes'] = [
'class' => [
'use-ajax',
],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'dialogClass' => 'social-dialog',
'title' => '',
'width' => 360,
]),
];
}
if (isset($routes[$operation])) {
$link['url'] = Url::fromRoute($routes[$operation], $link['url']
->getRouteParameters());
}
}
/** @var \Drupal\Core\Url $url */
$url =& $row[1]['data']['#links']['view']['url'];
$parameters = $url
->getRouteParameters();
$row = [
'data' => $row,
'class' => [
'revision-' . $parameters['data_policy_revision'],
],
];
}
return $build;
}