loads component with sites via prop

This commit is contained in:
buttle 2021-10-29 11:21:26 +02:00
parent c56464e086
commit dafe41912d
2 changed files with 16 additions and 9 deletions

1
asset/js/archive-list.js Symbolic link
View File

@ -0,0 +1 @@
../../../../../archive-lister/dist/archive-list.js

View File

@ -4,20 +4,26 @@ $archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
<?php <?php
$data = []; $collections = [];
foreach($sites as $site){ foreach($sites as $site){
$site_meta_values = $archiveSiteHelper->getSiteMetaValues($site); $site_data = $archiveSiteHelper->getSiteMetaValues($site);
$site_meta_values['url'] = $site->siteUrl(); $site_data['url'] = $site->siteUrl();
$site_meta_values['title'] = $site->title(); $site_data['title'] = $site->title();
$site_meta_values['summay'] = nl2br($this->escapeHtml($site->summary())); $site_data['summary'] = nl2br($this->escapeHtml($site->summary()));
array_push($data, $site_meta_values); array_push($collections, $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');
//$collections = str_replace("'", "\'", $collections);
$collections = htmlentities(json_encode($collections, JSON_HEX_QUOT), ENT_QUOTES, 'UTF-8');
//$collections = json_encode($collections);
?> ?>
<div data-vue-component="archive-list" <div data-vue-component="archive-list"
data-collections='<?= json_encode($data, JSON_UNESCAPED_SLASHES) ?>'> data-collections='<?= $collections ?>'>
</div> </div>
<script src="/themes/archive/asset/js/archive-list.js"></script>>
<script src="/themes/archive/asset/js/archive-list.js"></script>