$path) { $field['url'] = str_replace('{{' . $k . '}}', $this->Hash->extract($data, $path)[0], $field['url']); } } if (substr($field['url'], 0, 4) === 'http') { $baseurl = ''; } $string = sprintf( '%s', $baseurl, h($field['url']), h($string) ); } else if (empty($field['raw'])) { $string = h($string); } foreach (['info', 'warning', 'danger'] as $message_type) { if (!empty($field[$message_type])) { $string .= sprintf(' (%s)', $message_type, $field[$message_type]); } } echo $string;