From 8f8e8ff7bade373020ae92e94ed85252ea3ba8f3 Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Tue, 17 Apr 2012 22:13:50 +0000 Subject: [PATCH] In the WdnTemplate helper, allow a link to be defined as a string in addition to the existing array definition. --- library/Unl/View/Helper/WdnTemplate.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/library/Unl/View/Helper/WdnTemplate.php b/library/Unl/View/Helper/WdnTemplate.php index e6b510c..8055f1b 100644 --- a/library/Unl/View/Helper/WdnTemplate.php +++ b/library/Unl/View/Helper/WdnTemplate.php @@ -185,14 +185,20 @@ EOF; } $html = '<ul>' . PHP_EOL; foreach ($links as $link) { - $html .= '<li>' - . (isset($link['href']) ? '<a href="' . $this->_processUrl($link['href']) . '">' : '') - . $link['text'] - . (isset($link['href']) ? '</a>' : ''); - if (isset($link['children'])) { - $html .= PHP_EOL . $this->_processLinks($link['children']); - } - $html .= '</li>' . PHP_EOL; + if (is_array($link)) { + $html .= '<li>' + . (isset($link['href']) ? '<a href="' . $this->_processUrl($link['href']) . '">' : '') + . $link['text'] + . (isset($link['href']) ? '</a>' : ''); + if (isset($link['children'])) { + $html .= PHP_EOL . $this->_processLinks($link['children']); + } + $html .= '</li>' . PHP_EOL; + } else { + $html .= '<li>' + . $link + . '</li>' . PHP_EOL; + } } $html .= '</ul>' . PHP_EOL; -- GitLab