mirror of
https://github.com/getgrav/grav.git
synced 2026-07-08 16:53:16 +02:00
Fixed Flex Page cache key not taking account active language
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* Fixed `FlexObject::triggerEvent()` not emitting events [#2816](https://github.com/getgrav/grav/issues/2816)
|
||||
* Grav 1.7: Fixed saving Flex configuration with ignored values becoming null
|
||||
* Grav 1.7: Fixed `bin/plugin` initialization
|
||||
* Grav 1.7: Fixed Flex Page cache key not taking account active language
|
||||
|
||||
# v1.7.0-rc.5
|
||||
## 02/03/2020
|
||||
|
||||
@@ -19,6 +19,7 @@ use Grav\Common\Flex\Types\Pages\Traits\PageContentTrait;
|
||||
use Grav\Common\Flex\Types\Pages\Traits\PageLegacyTrait;
|
||||
use Grav\Common\Flex\Types\Pages\Traits\PageRoutableTrait;
|
||||
use Grav\Common\Flex\Types\Pages\Traits\PageTranslateTrait;
|
||||
use Grav\Common\Language\Language;
|
||||
use Grav\Common\Page\Pages;
|
||||
use Grav\Common\Utils;
|
||||
use Grav\Framework\Filesystem\Filesystem;
|
||||
@@ -129,6 +130,22 @@ class PageObject extends FlexPageObject
|
||||
return parent::getFormValue($name, $default, $separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @see FlexObjectInterface::getCacheKey()
|
||||
*/
|
||||
public function getCacheKey(): string
|
||||
{
|
||||
$cacheKey = parent::getCacheKey();
|
||||
if ($cacheKey) {
|
||||
/** @var Language $language */
|
||||
$language = Grav::instance()['language'];
|
||||
$cacheKey .= '_' . $language->getActive();
|
||||
}
|
||||
|
||||
return $cacheKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|bool $reorder
|
||||
* @return FlexObject|\Grav\Framework\Flex\Interfaces\FlexObjectInterface
|
||||
|
||||
@@ -81,7 +81,7 @@ trait PageTranslateTrait
|
||||
}
|
||||
|
||||
$header = $aPage->header();
|
||||
$routes = isset($header->routes) ? $header->routes : [];
|
||||
$routes = $header->routes ?? [];
|
||||
$route = $routes['default'] ?? $aPage->rawRoute();
|
||||
if (!$route) {
|
||||
$route = $aPage->route();
|
||||
|
||||
@@ -193,13 +193,14 @@ class FlexPageObject extends FlexObject implements PageInterface, MediaManipulat
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @see FlexObjectInterface::getCacheKey()
|
||||
*/
|
||||
public function getCacheKey(): string
|
||||
{
|
||||
return $this->hasKey() ? $this->getTypePrefix() . $this->getFlexType() . '.' . $this->getKey() . $this->getLanguage() : '';
|
||||
return $this->hasKey() ? $this->getTypePrefix() . $this->getFlexType() . '.' . $this->getKey() . '.' . $this->getLanguage() : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user