SilverStripe\Subsites\State\SubsiteState
SubsiteState provides static access to the current state for subsite related data during a request
Synopsis
class SubsiteState
implements
Resettable
{
- // members
- protected int|null $subsiteId;
- protected int|null $originalSubsiteId;
- protected bool $useSessions;
- // methods
- public int|null getSubsiteId()
- public $this setSubsiteId()
- public bool getUseSessions()
- public $this setUseSessions()
- public bool getSubsiteIdWasChanged()
- public mixed withState()
- public static void reset()
- public void resetState()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
Implements
- SilverStripe\Core\Resettable
Members
protected
- $originalSubsiteId — SilverStripe\Subsites\State\int|null
- $subsiteId — SilverStripe\Subsites\State\int|null
- $useSessions — SilverStripe\Subsites\State\bool
Methods
public
- getSubsiteId() — Get the current subsite ID
- getSubsiteIdWasChanged() — Get whether the subsite ID has been changed during a request, based on the original and current IDs
- getUseSessions() — Get whether to use sessions for storing the subsite ID
- reset() — Reset the local cache of the singleton
- resetState() — Reset the local cache of this object
- setSubsiteId() — Set the current subsite ID, and track the first subsite ID set as the "original". This is used to check whether the ID has been changed through a request.
- setUseSessions() — Set whether to use sessions for storing the subsite ID
- withState() — Perform a given action within the context of a new, isolated state. Modifications are temporary and the existing state will be restored afterwards.