Skip to content

Commit

Permalink
Merge ee3cd9b into 42f5f52
Browse files Browse the repository at this point in the history
  • Loading branch information
losted committed Nov 8, 2019
2 parents 42f5f52 + ee3cd9b commit 398df86
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Charcoal/Cms/Route/GenericRoute.php
Expand Up @@ -128,7 +128,7 @@ public function pathResolvable(Container $container)
return false;
}

return (!!$contextObject->active() && !!$contextObject->isActiveRoute());
return (!!$contextObject['active'] && !!$contextObject->isActiveRoute());
}

/**
Expand Down Expand Up @@ -229,7 +229,7 @@ protected function resolveTemplateContextObject()

$objectRoute = $this->getObjectRouteFromPath();
$contextObject = $this->getContextObject();
$currentLang = $objectRoute->lang();
$currentLang = $objectRoute->getLang();

// Set language according to the route's language
$this->setLocale($currentLang);
Expand All @@ -241,14 +241,14 @@ protected function resolveTemplateContextObject()
$identProperty = $contextObject->property('template_ident');

// Methods from TemplateableInterface / Trait
$templateIdent = $contextObject->templateIdent() ?: $objectRoute->routeTemplate();
$templateIdent = $contextObject->templateIdent() ?: $objectRoute->getRouteTemplate();
// Default fallback to routeTemplate
$controllerIdent = $contextObject->controllerIdent() ?: $templateIdent;

$templateChoice = $identProperty->choice($templateIdent);
} else {
// Use global templates to verify for custom paths
$templateIdent = $objectRoute->routeTemplate();
$templateIdent = $objectRoute->getRouteTemplate();
$controllerIdent = $templateIdent;
foreach ($this->availableTemplates as $templateKey => $templateData) {
if (!isset($templateData['value'])) {
Expand Down Expand Up @@ -300,7 +300,7 @@ protected function resolveTemplateContextObject()
}

// Merge Route options from object-route
$routeOptions = $objectRoute->routeOptions();
$routeOptions = $objectRoute->getRouteOptions();
if ($routeOptions && count($routeOptions)) {
$config['template_data'] = array_merge($config['template_data'], $routeOptions);
}
Expand Down Expand Up @@ -371,8 +371,8 @@ protected function loadContextObject()
{
$route = $this->getObjectRouteFromPath();

$obj = $this->modelFactory()->create($route->routeObjType());
$obj->load($route->routeObjId());
$obj = $this->modelFactory()->create($route->getRouteObjType());
$obj->load($route->getRouteObjId());

return $obj;
}
Expand Down Expand Up @@ -437,15 +437,15 @@ public function getLatestObjectPathHistory(ObjectRouteInterface $route)
$loader
->setModel($route)
->addFilter('active', true)
->addFilter('route_obj_type', $route->routeObjType())
->addFilter('route_obj_id', $route->routeObjId())
->addFilter('lang', $route->lang())
->addFilter('route_obj_type', $route->getRouteObjType())
->addFilter('route_obj_id', $route->getRouteObjId())
->addFilter('lang', $route->getLang())
->addOrder('creation_date', 'desc')
->setPage(1)
->setNumPerPage(1);

if ($route->routeOptionsIdent()) {
$loader->addFilter('route_options_ident', $route->routeOptionsIdent());
if ($route->getRouteOptionsIdent()) {
$loader->addFilter('route_options_ident', $route->getRouteOptionsIdent());
} else {
$loader->addFilter('route_options_ident', '', ['operator' => 'IS NULL']);
}
Expand Down

0 comments on commit 398df86

Please sign in to comment.