2020-05-29 13:41:58 +02:00
|
|
|
<?php
|
2020-12-07 17:17:11 +01:00
|
|
|
if (isset($field['raw'])) {
|
2020-09-28 01:25:07 +02:00
|
|
|
$string = $field['raw'];
|
|
|
|
} else {
|
2021-06-01 07:46:29 +02:00
|
|
|
$value = 1;
|
2020-09-28 01:25:07 +02:00
|
|
|
$value = Cake\Utility\Hash::extract($data, $field['path']);
|
|
|
|
$string = empty($value[0]) ? '' : $value[0];
|
|
|
|
}
|
2020-06-19 00:43:11 +02:00
|
|
|
if (!empty($field['url'])) {
|
|
|
|
if (!empty($field['url_vars'])) {
|
|
|
|
if (!is_array($field['url_vars'])) {
|
|
|
|
$field['url_vars'] = [$field['url_vars']];
|
|
|
|
}
|
|
|
|
foreach ($field['url_vars'] as $k => $path) {
|
|
|
|
$field['url'] = str_replace('{{' . $k . '}}', $this->Hash->extract($data, $path)[0], $field['url']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$string = sprintf(
|
2021-02-09 22:10:26 +01:00
|
|
|
'<a href="%s%s">%s</a>',
|
|
|
|
$baseurl,
|
2020-06-19 00:43:11 +02:00
|
|
|
h($field['url']),
|
|
|
|
$string
|
|
|
|
);
|
|
|
|
}
|
|
|
|
echo $string;
|