diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-10-12 15:25:13 -0700 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-10-12 15:25:13 -0700 |
commit | 7c52546ed2b5ed724d19af95fe97726ab6156291 (patch) | |
tree | ad48580069860a4ef8970805615cdaad0a8f857d /app/Helper | |
parent | 4bb422b41fd995cb67c41ad4b7ba155a84c6f1eb (diff) |
Generate a link if the reference is a URL
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/TaskHelper.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 3b9e9745..065ece10 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -220,6 +220,21 @@ class TaskHelper extends Base return $html; } + public function renderReference(array $task) + { + if (! empty($task['reference'])) { + $reference = $this->helper->text->e($task['reference']); + + if (filter_var($task['reference'], FILTER_VALIDATE_URL) !== false) { + return sprintf('<a href="%s" target=_blank">%s</a>', $reference, $reference); + } + + return $reference; + } + + return ''; + } + public function getProgress($task) { if (! isset($this->columns[$task['project_id']])) { |