protected function MobileDetectCache::mobile_detect_caching_alter_cid in Mobile Detect 7
Determines a prefix for the page cache $cid based on devide type.
Return value
string The $cid prefix
2 calls to MobileDetectCache::mobile_detect_caching_alter_cid()
- MobileDetectCache::getMultiple in mobile_detect_caching/
mobile_detect_caching.inc - Implements DrupalCacheInterface::getMultiple().
- MobileDetectCache::set in mobile_detect_caching/
mobile_detect_caching.inc - Implements DrupalCacheInterface::set().
File
- mobile_detect_caching/
mobile_detect_caching.inc, line 56 - Cache backend include for the mobile_detect_caching module.
Class
- MobileDetectCache
- Defines a Mobile Detect cache implementation.
Code
protected function mobile_detect_caching_alter_cid() {
$device = '';
if (class_exists('Mobile_Detect')) {
try {
$detect = new Mobile_Detect();
if ($detect
->isMobile() && $detect
->isTablet() == FALSE) {
$device = 'mobile:';
}
elseif ($detect
->isTablet()) {
$device = 'tablet:';
}
} catch (Exception $e) {
// nop
}
}
return $device;
}