BlockEnabled.php in Site Audit 8.3
File
src/Plugin/SiteAuditCheck/BlockEnabled.php
View source
<?php
namespace Drupal\site_audit\Plugin\SiteAuditCheck;
use Drupal\site_audit\Plugin\SiteAuditCheckBase;
class BlockEnabled extends SiteAuditCheckBase {
public function getResultFail() {
return $this
->t('Block caching is not enabled!');
}
public function getResultInfo() {
return $this
->t('Block is not enabled.');
}
public function getResultPass() {
return $this
->t('Block is enabled.');
}
public function getResultWarn() {
return $this
->t("Block is enabled, but there is no default theme. Consider disabling block if you don't need it.");
}
public function getAction() {
}
public function calculateScore() {
if (!\Drupal::service('module_handler')
->moduleExists('block')) {
$this->abort = TRUE;
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_INFO;
}
$this->registry->theme_default = \Drupal::config('system.theme')
->get('default');
if (!$this->registry->theme_default) {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS;
}
}