Skip to content

Commit

Permalink
Merge pull request #2042 from Daniel-KM/fix/site_slug_false
Browse files Browse the repository at this point in the history
Fixed routing when site-slug is boolean false.
  • Loading branch information
zerocrates authored Mar 29, 2023
2 parents 078653c + 36e9f2e commit 5388907
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions application/src/Mvc/MvcListeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ public function prepareAdmin(MvcEvent $event)

$event->getViewModel()->setTemplate('layout/layout-admin');

if ($routeMatch->getParam('__SITEADMIN__')
&& $routeMatch->getParam('site-slug')
) {
if ($routeMatch->getParam('__SITEADMIN__')) {
$this->prepareSite($event);
}
}
Expand Down Expand Up @@ -388,6 +386,10 @@ protected function prepareSite(MvcEvent $event)
$services = $event->getApplication()->getServiceManager();
$siteSlug = $event->getRouteMatch()->getParam('site-slug');

if (!is_string($siteSlug) || !strlen($siteSlug)) {
return false;
}

try {
$site = $services->get('Omeka\ApiManager')
->read('sites', ['slug' => $siteSlug])->getContent();
Expand Down
2 changes: 1 addition & 1 deletion application/src/Mvc/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function setIsInstalled($isInstalled)
/**
* Get the route match.
*
* @return Laminas\Router\Http\RouteMatch
* @return \Laminas\Router\Http\RouteMatch
*/
public function getRouteMatch()
{
Expand Down
2 changes: 1 addition & 1 deletion application/src/View/Helper/CurrentSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Laminas\View\Helper\AbstractHelper;

/**
* CView helper for getting the current site representation.
* View helper for getting the current site representation.
*/
class CurrentSite extends AbstractHelper
{
Expand Down

0 comments on commit 5388907

Please sign in to comment.