array(
'colour' => 'green',
'text' => 'allowed'
),
'NOT' => array(
'colour' => 'red',
'text' => 'blocked'
)
);
if (
!empty($this->Hash->extract($row, $field['data_path'])[0]) &&
!empty($field['rule_path'][0]) &&
!empty($this->Hash->extract($row, $field['rule_path'])[0])
) {
$rules = $this->Hash->extract($row, $field['rule_path'])[0];
$rules = json_decode($rules, true);
foreach ($rules as $rule => $rule_data) {
if (is_array($rule_data)) {
foreach ($rule_data as $boolean => $values) {
if (!empty($values)) {
if (is_array($values)) {
$values = implode(', ', $values);
}
$rules_raw[] = sprintf(
'%s %s: %s',
h(\Cake\Utility\Inflector::humanize($rule)),
$typeOptions[$boolean]['text'],
$typeOptions[$boolean]['colour'],
h($values)
);
}
}
} else if (!empty($rule_data)){
$rules_raw[] = sprintf(
'%s: %s',
h(\Cake\Utility\Inflector::humanize($rule)),
h($rule_data)
);
}
}
$rules_raw = implode('
', $rules_raw);
}
echo sprintf(
'%s',
(!empty($this->Hash->extract($row, $field['data_path'])[0])) ? 'check' : 'times',
empty($rules_raw) ? '' :
sprintf(
' (%s)',
__('Filter rules'),
$rules_raw,
__('Rules')
)
);
?>