[2.1.0-pl]
Added
- Service API:
resolveDevice(),getDeviceType(),isMobile(),isTablet(),isDesktop(). - Fenom modifier
|mobiledetectfor conditional output ({if 'mobile' | mobiledetect}). - Example chunk
tplMobileDetectSwitchwith links to force desktop, tablet, mobile or auto-detect mode.
Changed
- Updated
mobiledetect/mobiledetectlibto 4.11.x (Detection\MobileDetect). - Explicit MODX Revolution 2.8+ and MODX 3.x support; transport build uses PSR-4 bootstrap for
modPackageBuilderon MODX 3. - Fixed Fenom block functions (
{mobile},{phone},{tablet},{desktop},{standard}) returning empty string instead of implicitnull. - Fixed repeated Fenom registration on
pdoToolsOnFenomInit(memory exhaustion on large Fenom templates). - Fenom init guard uses
getTag('mobile')instead ofgetModifier('mobiledetect'): pdoTools autoloads unknown modifiers as snippets, so the old check skipped block registration. - Plugin is packaged as non-static (
static = 0): a static plugin with a media source caused memory exhaustion while Fenom was still initializing. - Wrapped
mobiledetectPluginService()infunction_exists()so the plugin can run on bothpdoToolsOnFenomInitandOnWebPagePrerenderin one request. - Skip cookie writes in CLI and after headers are sent (
canPersistCookie()). - Fixed potential infinite recursion in
parseDocument()when saved cookie mode equals the current pass.
Fixed
- System setting
md_disable_plugindefault aligned with transport settings: plugin is enabled by default (false). md_tablet_is_standardnow remaps tablet → standard for snippet, Fenom blocks/modifier and service API (resolveDevice,isDesktop,isTablet), not only HTML tags.
Breaking Changes
- Requires PHP 8.2+ (mobiledetectlib 4.11.x).
- Internal detector class changed from
\Mobile_DetecttoDetection\MobileDetect. Custom code that calledgetDetector()and relied on the legacy class must update imports and API usage.
Dependencies
mobiledetect/mobiledetectlib^4.11psr/simple-cache^1.0 || ^2.0 || ^3.0
New Contributors
- @Ibochkarev made their first contribution in #4
Full Changelog: https://github.com/modx-pro/MobileDetect/commits/2.1.0-pl