3 use Drupal\Core\Template\Attribute;
7 * Theme project status report.
11 function template_preprocess_hacked_detailed_report(&$variables) {
12 $project = $variables['project'];
14 $variables['files'] = [
16 '#attributes' => ['class' => ['update']],
17 // Attach the library to a variable that gets printed always.
20 'update/drupal.update.admin',
25 foreach ($project['files'] as $file => $status) {
26 if (!isset($status)) {
31 if (\Drupal::currentUser()->hasPermission('view diffs of changed files') && \Drupal::moduleHandler()->moduleExists('diff') && ($status != HACKED_STATUS_UNHACKED) && !empty($project['diffable'][$file])) {
32 $url = Url::fromRoute('hacked.project_diff', ['project' => $project['project_name'], 'file' => $file ]);
36 '#theme' => 'hacked_file_status',
44 // Add the project status row and details.
45 $variables['files'][$file]['status'] = $file_status;
48 case HACKED_STATUS_UNHACKED:
49 $variables['files'][$file]['#attributes'] = ['class' => ['color-success']];
51 case HACKED_STATUS_DELETED:
52 $variables['files'][$file]['#attributes'] = ['class' => ['color-error']];
54 case HACKED_STATUS_HACKED:
55 case HACKED_STATUS_PERMISSION_DENIED:
56 case HACKED_STATUS_UNCHECKED:
58 $variables['files'][$file]['#attributes'] = ['class' => ['color-warning']];
67 function template_preprocess_hacked_file_status(&$variables) {
68 switch ($variables['file']['status']) {
69 case HACKED_STATUS_UNHACKED:
70 $uri = 'core/misc/icons/73b355/check.svg';
71 $text = t('Unchanged');
73 case HACKED_STATUS_DELETED:
74 $uri = 'core/misc/icons/e32700/error.svg';
77 case HACKED_STATUS_HACKED:
78 $uri = 'core/misc/icons/e29700/warning.svg';
79 $text = t('Changed!');
81 case HACKED_STATUS_PERMISSION_DENIED:
82 $uri = 'core/misc/icons/e29700/warning.svg';
83 $text = t('Permission Denied');
85 case HACKED_STATUS_UNCHECKED:
87 $uri = 'core/misc/icons/e29700/warning.svg';
88 $text = t('Unchecked');
92 $variables['status']['attributes'] = new Attribute();
93 $variables['status']['label'] = $text;
94 $variables['status']['icon'] = [