Hash->get($row, $field['data_path']);
$seed = rand();
$checkboxId = 'GenericToggle-' . $seed;
$tempboxId = 'TempBox-' . $seed;
$requirementMet = false;
if (isset($field['toggle_data']['editRequirement'])) {
if (isset($field['toggle_data']['editRequirement']['options']['datapath'])) {
foreach ($field['toggle_data']['editRequirement']['options']['datapath'] as $name => $path) {
$field['toggle_data']['editRequirement']['options']['datapath'][$name] = empty($this->Hash->extract($row, $path)[0]) ? null : $this->Hash->extract($row, $path)[0];
}
}
$options = isset($field['toggle_data']['editRequirement']['options']) ? $field['toggle_data']['editRequirement']['options'] : array();
$requirementMet = $field['toggle_data']['editRequirement']['function']($row, $options);
}
echo sprintf(
'',
$checkboxId,
empty($data) ? '' : 'checked',
$requirementMet ? '' : 'disabled="disabled"',
$tempboxId
);
// inject variables into the strings
if (!empty($field['toggle_data']['confirm'])) {
$field['toggle_data']['confirm']['enable']['arguments'] = isset($field['toggle_data']['confirm']['enable']['arguments']) ? $field['toggle_data']['confirm']['enable']['arguments'] : [];
$field['toggle_data']['confirm']['disable']['arguments'] = isset($field['toggle_data']['confirm']['disable']['arguments']) ? $field['toggle_data']['confirm']['disable']['arguments'] : [];
$stringArrayEnable = $field['toggle_data']['confirm']['enable'];
unset($stringArrayEnable['arguments']);
$stringArrayDisable = $field['toggle_data']['confirm']['disable'];
unset($stringArrayDisable['arguments']);
$confirmOptions = [
'enable' => $this->DataFromPath->buildStringsInArray($stringArrayEnable, $row, $field['toggle_data']['confirm']['enable']['arguments'], ['highlight' => true]),
'disable' => $this->DataFromPath->buildStringsInArray($stringArrayDisable, $row, $field['toggle_data']['confirm']['disable']['arguments'], ['highlight' => true]),
];
}
$url = $this->DataFromPath->buildStringFromDataPath($field['url'], $row, $field['url_params_vars']);
?>