Commit 9f1a6d3c authored by gbyte.co's avatar gbyte.co

Improve status display

parent 9f04f3a7
......@@ -153,7 +153,17 @@ class SimplesitemapSitemapsForm extends SimplesitemapFormBase {
];
foreach ($variants as $variant_name => $variant_definition) {
$row = [];
$row['name']['data']['#markup'] = '<span title="' . $variant_name . '">' . $this->t($variant_definition['label']) . '</span>';
switch ($sitemap_statuses[$variant_name]) {
case 0:
$row['name']['data']['#markup'] = '<span title="' . $variant_name . '">' . $this->t($variant_definition['label']) . '</span>';
break;
case 1:
case 2:
$row['name']['data']['#markup'] = $this->t('<a href="@url" target="_blank">@variant</a>',
['@url' => $sitemap_generator->setSitemapVariant($variant_name)->getSitemapUrl(), '@variant' => $this->t($variant_definition['label'])]
);
break;
}
if (!isset($sitemap_statuses[$variant_name])) {
$row['status'] = $this->t('pending');
}
......@@ -163,12 +173,11 @@ class SimplesitemapSitemapsForm extends SimplesitemapFormBase {
$row['status'] = $this->t('generating');
break;
case 1:
$row['status']['data']['#markup'] = $this->t('<a href="@url" target="_blank">published on @time</a>',
['@url' => $sitemap_generator->setSitemapVariant($variant_name)->getSitemapUrl(), '@time' => $this->dateFormatter->format($published_timestamps[$variant_name])]
$row['status'] = $this->t('published on @time', ['@time' => $this->dateFormatter->format($published_timestamps[$variant_name])]
);
break;
case 2:
$row['status'] = $this->t('<a href="@url" target="_blank">published on @time</a>, regenerating',
$row['status'] = $this->t('published on @time, regenerating',
['@url' => $sitemap_generator->setSitemapVariant($variant_name)->getSitemapUrl(), '@time' => $this->dateFormatter->format($published_timestamps[$variant_name])]
);
break;
......@@ -183,26 +192,6 @@ class SimplesitemapSitemapsForm extends SimplesitemapFormBase {
$form['simple_sitemap_settings']['status']['types']['#markup'] = $this->t('No variants have been defined');
}
/* if (!empty($sitemap_statuses)) {
$form['simple_sitemap_settings']['status']['types']['&orphans'] = [
'#type' => 'details',
'#title' => $this->t('Orphans'),
'#open' => TRUE,
];
$form['simple_sitemap_settings']['status']['types']['&orphans']['table'] = [
'#type' => 'table',
'#header' => [$this->t('Variant'), $this->t('Status'), $this->t('Actions')],
];
foreach ($sitemap_statuses as $orphan_name => $orphan_info) {
$form['simple_sitemap_settings']['status']['types']['&orphans']['table']['#rows'][$orphan_name] = [
'name' => $orphan_name,
'status' => $this->t('orphaned'),
'actions' => '',
];
}
}*/
return $form;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment