mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Merge pull request #419 from creative-commoners/pulls/2.3/fix-sitetree-hints-caching
FIX allowed pagetypes displaying incorrectly when switching subsite
This commit is contained in:
commit
b8576744a1
@ -50,6 +50,7 @@ SilverStripe\Admin\SecurityAdmin:
|
||||
|
||||
SilverStripe\CMS\Controllers\CMSMain:
|
||||
extensions:
|
||||
- SilverStripe\Subsites\Extensions\HintsCacheKeyExtension
|
||||
- SilverStripe\Subsites\Extensions\SubsiteMenuExtension
|
||||
|
||||
SilverStripe\CMS\Controllers\CMSPagesController:
|
||||
|
22
src/Extensions/HintsCacheKeyExtension.php
Normal file
22
src/Extensions/HintsCacheKeyExtension.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\Subsites\Extensions;
|
||||
|
||||
use SilverStripe\CMS\Controllers\CMSMain;
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\Subsites\State\SubsiteState;
|
||||
|
||||
/**
|
||||
* This extension adds the current Subsite ID as an additional factor to the Hints Cßache Key, which is used to cache
|
||||
* the Site Tree Hints (which include allowed pagetypes).
|
||||
*
|
||||
* @package SilverStripe\Subsites\Extensions
|
||||
* @see CMSMain::generateHintsCacheKey()
|
||||
*/
|
||||
class HintsCacheKeyExtension extends Extension
|
||||
{
|
||||
public function updateHintsCacheKey(&$baseKey)
|
||||
{
|
||||
$baseKey .= '_Subsite:' . SubsiteState::singleton()->getSubsiteId();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user