<?php
$archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
?>

<?php
$collections = $archiveSiteHelper->getCollections();
$projects = [];
foreach($sites as $site){
  $site_data = $archiveSiteHelper->getSiteMetaValues($site);
  $site_data['id'] = $site->id();
  $site_data['url'] = $site->siteUrl();
  $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()));
  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_HEX_APOS);
//$collections = htmlspecialchars(json_encode($collections), ENT_QUOTES, 'UTF-8');
$projects = htmlentities(json_encode($projects, JSON_HEX_QUOT), ENT_QUOTES, 'UTF-8');
?>

<div id="site-list">
  <div
       data-vue-component="archive-list"
       data-collections='<?= $projects ?>'
       data-page_size=20>
  </div>
</div>


<script src="/themes/archive/asset/js/archive-list.js"></script>
