ContentVocabulariesUnused.php in Site Audit 8.3
File
src/Plugin/SiteAuditCheck/ContentVocabulariesUnused.php
View source
<?php
namespace Drupal\site_audit\Plugin\SiteAuditCheck;
use Drupal\site_audit\Plugin\SiteAuditCheckBase;
class ContentVocabulariesUnused extends SiteAuditCheckBase {
public function getResultFail() {
}
public function getResultInfo() {
}
public function getResultPass() {
return $this
->t('There are no unused vocabularies.');
}
public function getResultWarn() {
return $this
->t('The following vocabularies are unused: @vocabularies_unused', [
'@vocabularies_unused' => implode(', ', $this->registry->vocabulary_unused),
]);
}
public function getAction() {
if ($this
->getScore() == SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN) {
return $this
->t('Consider removing unused vocabularies.');
}
}
public function calculateScore() {
if (!isset($this->registry->vocabulary_unused)) {
$this
->checkInvokeCalculateScore('content_vocabularies');
}
if (empty($this->registry->vocabulary_unused)) {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_WARN;
}
}