public function SiteAuditCheckContentFieldsUnused::calculateScore in Site Audit 8.2
Same name and namespace in other branches
- 7 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 $bundle_name => $entity_types) {
foreach ($entity_types as $entity_type => $fields) {
foreach ($fields as $field_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;
}