MobileDetectStatusBlock.php in Mobile Detect 8.2
File
src/Plugin/Block/MobileDetectStatusBlock.php
View source
<?php
namespace Drupal\mobile_detect\Plugin\Block;
use Drupal\Core\Block\BlockBase;
class MobileDetectStatusBlock extends BlockBase {
public function build() {
$renderable = [
'#theme' => 'mobile_detect_status_block',
'#internal_cache' => $this
->internalCacheStatus(),
];
return $renderable;
}
private function internalCacheStatus() {
$enabled = false;
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler
->moduleExists('cache_page')) {
$enabled = true;
}
return $enabled;
}
}