public function SiteAuditCheckContentFieldsUnused::calculateScore in Site Audit 7
Same name and namespace in other branches
- 8.2 Check/Content/FieldsUnused.php \SiteAuditCheckContentFieldsUnused::calculateScore()
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
Content/ FieldsUnused.php, line 68 - Contains \SiteAudit\Check\Content\FieldsUnused.
Class
- SiteAuditCheckContentFieldsUnused
- Class SiteAuditCheckContentFieldsUnused.
Code
public function calculateScore() {
$this->registry['fields_unused'] = array();
foreach ($this->registry['field_instance_counts'] as $entity_type => $fields) {
foreach ($fields as $field_name => $bundles) {
foreach ($bundles as $bundle_name => $count) {
if (!$count) {
$this->registry['fields_unused'][$entity_type . '-' . $bundle_name][] = $field_name;
}
}
}
}
if (!empty($this->registry['fields_unused'])) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}