ensures all site data is present

This commit is contained in:
buttle 2021-11-24 13:21:57 +01:00
parent e951669cff
commit 60eac3e67a
2 changed files with 14 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,29 +2,35 @@
$archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta'); $archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
?> ?>
<?php <?php
$collections = []; $collections = $archiveSiteHelper->getCollections();
$projects = [];
foreach($sites as $site){ foreach($sites as $site){
$site_data = $archiveSiteHelper->getSiteMetaValues($site); $site_data = $archiveSiteHelper->getSiteMetaValues($site);
$site_data['id'] = $site->id(); $site_data['id'] = $site->id();
$site_data['url'] = $site->siteUrl(); $site_data['url'] = $site->siteUrl();
$site_data['title'] = $site->title(); $site_data['title'] = $site->title();
if (isset($site_data['collection'])) {
$site_data['collection'] = $collections[$site_data['collection']];
} else {
$site_data['collection'] = "";
}
$site_data['summary'] = nl2br($this->escapeHtml($site->summary())); $site_data['summary'] = nl2br($this->escapeHtml($site->summary()));
array_push($collections, $site_data); if (!isset($site_data['currator'])) {
$site_data['currator'] = "";
}
array_push($projects, $site_data);
} }
//$collections = json_encode($collections, JSON_UNESCAPED_SLASHES); //$collections = json_encode($collections, JSON_UNESCAPED_SLASHES);
//$collections = json_encode($collections, JSON_HEX_APOS); //$collections = json_encode($collections, JSON_HEX_APOS);
//$collections = htmlspecialchars(json_encode($collections), ENT_QUOTES, 'UTF-8'); //$collections = htmlspecialchars(json_encode($collections), ENT_QUOTES, 'UTF-8');
//$collections = str_replace("'", "\'", $collections); $projects = htmlentities(json_encode($projects, JSON_HEX_QUOT), ENT_QUOTES, 'UTF-8');
$collections = htmlentities(json_encode($collections, JSON_HEX_QUOT), ENT_QUOTES, 'UTF-8');
//$collections = json_encode($collections);
?> ?>
<div id="site-list"> <div id="site-list">
<div <div
data-vue-component="archive-list" data-vue-component="archive-list"
data-collections='<?= $collections ?>' data-collections='<?= $projects ?>'
data-page_size=3> data-page_size=3>
</div> </div>
</div> </div>