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 {
|
|
|
|
$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(
|
|
|
|
'<a href="%s">%s</a>',
|
|
|
|
h($field['url']),
|
|
|
|
$string
|
|
|
|
);
|
|
|
|
}
|
|
|
|
echo $string;
|