XD\Basic\Extensions\MobileDetectExtension
Class MobileDetectExtension
Synopsis
class MobileDetectExtension
extends Extension
{
- // members
- protected boolean $isMobile = false;
- protected boolean $isPhone = false;
- protected boolean $isTablet = false;
- // methods
- public void onBeforeInit()
- public boolean getIsMobile()
- public boolean getIsPhone()
- public boolean getIsTablet()
- public bool getIsDev()
- public void setIsMobile()
- public void setIsPhone()
- public void setIsTablet()
Hierarchy
Extends
- SilverStripe\Core\Extension
Members
protected
- $isMobile
- $isPhone
- $isTablet
Methods
public
- getIsDev() — Return true for all environments except live
- getIsMobile() — Check if the user is on a mobile device
- getIsPhone() — Check if the user is on a phone
- getIsTablet() — Check if the user is on a tablet device
- onBeforeInit() — Add the detection to the ContentController This way the methods get exposed to controllers extended on the ContentController
- setIsMobile() — Set if the controller is requested by a mobile device
- setIsPhone() — Set if the controller is requested by a phone
- setIsTablet() — Set if the controller is requested by a tablet