requires a default site with title: "Collections"

This commit is contained in:
buttle 2021-05-24 18:16:28 +02:00
parent 00b5ea76ff
commit 9f70b7b21e
4 changed files with 11 additions and 26 deletions

View File

@ -13,8 +13,6 @@ use Laminas\Mvc\Controller\AbstractController;
use Omeka\Mvc\Controller\Plugin\Messenger; use Omeka\Mvc\Controller\Plugin\Messenger;
class Module extends AbstractModule class Module extends AbstractModule
{ {
const NAMESPACE = __NAMESPACE__; const NAMESPACE = __NAMESPACE__;
@ -37,21 +35,12 @@ class Module extends AbstractModule
public function onEventMergeConfig(ModuleEvent $event): void public function onEventMergeConfig(ModuleEvent $event): void
{ {
// Check if the main site is skipped, else the standard urls apply.
#if (!SLUG_MAIN_SITE) {
# return;
#}
/** @var \Laminas\ModuleManager\Listener\ConfigListener $configListener */ /** @var \Laminas\ModuleManager\Listener\ConfigListener $configListener */
$configListener = $event->getParam('configListener'); $configListener = $event->getParam('configListener');
// At this point, the config is read only, so it is copied and replaced. // At this point, the config is read only, so it is copied and replaced.
$config = $configListener->getMergedConfig(false); $config = $configListener->getMergedConfig(false);
/*
if (isset($config['view_helpers']['invokables']['Omeka\Form\Element\HtmlTextarea'])) {
unset($config['view_helpers']['invokables']['Omeka\Form\Element\HtmlTextarea']);
}
*/
/* /*
if (isset($config['block_layouts']['factories']['html'])) { if (isset($config['block_layouts']['factories']['html'])) {
unset($config['block_layouts']['factories']['html']); unset($config['block_layouts']['factories']['html']);
@ -66,19 +55,7 @@ class Module extends AbstractModule
if (isset($config['block_layouts']['invokables']['browsePreview'])) { if (isset($config['block_layouts']['invokables']['browsePreview'])) {
unset($config['block_layouts']['invokables']['browsePreview']); unset($config['block_layouts']['invokables']['browsePreview']);
} }
// Manage the routes for the main site when "s/site-slug/" is skipped.
// So copy routes from "site", without starting "/".
/*
foreach ($config['router']['routes']['site']['child_routes'] as $routeName => $options) {
// Skip some routes for pages that are set directly in the config.
if (isset($config['router']['routes']['top']['child_routes'][$routeName])) {
continue;
}
$config['router']['routes']['top']['child_routes'][$routeName] = $options;
$config['router']['routes']['top']['child_routes'][$routeName]['options']['route'] =
ltrim($config['router']['routes']['top']['child_routes'][$routeName]['options']['route'], '/');
}
*/
$configListener->setMergedConfig($config); $configListener->setMergedConfig($config);
} }

View File

@ -8,10 +8,10 @@ return [
], ],
'template_map' => [ 'template_map' => [
//'layout/layout' => __DIR__ . '/../../../themes/archive/view/layout/layout.phtml', //'layout/layout' => __DIR__ . '/../../../themes/archive/view/layout/layout.phtml',
'omeka/index/index' => __DIR__ . '/../../../themes/archive/view/omeka/site/index.phtml', //'omeka/index/index' => __DIR__ . '/../../../themes/archive/view/omeka/site/index/index.phtml',
'omeka/search/results' => __DIR__ . '/../../../themes/archive/view/omeka/search/results.phtml', 'omeka/search/results' => __DIR__ . '/../../../themes/archive/view/omeka/search/results.phtml',
'omeka/site-admin/page/edit' => __DIR__ . '/../../../themes/archive/view/omeka/site-admin/page/edit.phtml', 'omeka/site-admin/page/edit' => __DIR__ . '/../../../themes/archive/view/omeka/site-admin/page/edit.phtml',
'common/site-list-entry' => __DIR__ . '/../../../themes/archive/view/common/site-list-entry.phtml', //'common/site-list-entry' => __DIR__ . '/../../../themes/archive/view/common/site-list-entry.phtml',
], ],
], ],
'view_helpers' => [ 'view_helpers' => [

View File

@ -96,10 +96,16 @@ class ArchiveSiteMeta extends AbstractBlockLayout
public function render(PhpRenderer $view, SitePageBlockRepresentation $block) public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
{ {
if ($view->site->title() === "Collections") {
$site = null;
} else {
$site = $view->site;
}
return $view->partial('common/block-layout/site-meta', [ return $view->partial('common/block-layout/site-meta', [
'artist' =>$block->dataValue('currator'), 'artist' =>$block->dataValue('currator'),
'project_date' => $block->dataValue('project_date'), 'project_date' => $block->dataValue('project_date'),
'collection' => $block->dataValue('collection'), 'collection' => $block->dataValue('collection'),
'site' => $site,
]); ]);
} }
} }

View File

@ -1,4 +1,5 @@
<?php if($site !== null): ?>
<ul> <ul>
<li> <li>
<?= $artist ?> <?= $artist ?>
@ -10,3 +11,4 @@
<?= $collection ?> <?= $collection ?>
</li> </li>
</ul> </ul>
<?php endif; ?>