Commit 18d160fd authored by THEO GUILLON's avatar THEO GUILLON
Browse files

Merge branch '210-articles-dans-la-faq' into '2.0.0'

Resolve "Articles dans la FAQ"

See merge request libriciel/pole-citoyens/web-DPO/web-DPO!408
parents d37e18a2 78f96463
......@@ -151,6 +151,9 @@ msgstr "Action"
msgid "default.titreFAQ"
msgstr "FAQ"
msgid "default.titleFAQ"
msgstr "Foire aux questions"
msgid "default.sousTitreToutesLaFAQ"
msgstr "Toute la FAQ"
......
......@@ -21,13 +21,15 @@ class WebdpoMenuHelper extends AppHelper {
* @fixme
* @return string
*/
public function main($items, $disabledTag = 'a', $level = 0, $extraTopUlClass = null) {
public function main($items, $disabledTag = 'a', $level = 0, $extraTopUlClass = null)
{
$return = '';
foreach ($items as $key => $item) {
if (is_numeric($key) && $item === 'divider') {
$return .= $this->Html->tag('li', '<!---->', array('class' => 'divider'));
$return .= $this->Html->tag('li', '<!---->', ['class' => 'divider']);
} elseif (is_numeric($key) && is_string($item)) {
$return .= $this->Html->tag('li', $item, array('class' => 'dropdown-header'));
$return .= $this->Html->tag('li', $item, ['class' => 'dropdown-header']);
} elseif (!isset($item['disabled']) || !$item['disabled']) {
$sub = $item;
$title = ( isset($sub['title']) ? $sub['title'] : false );
......@@ -45,7 +47,7 @@ class WebdpoMenuHelper extends AppHelper {
$sub = $this->main($sub, $disabledTag, $level+1);
$content = '';
$htmlOptions = array('title' => $title);
$htmlOptions = ['title' => $title];
// Cas array('url' => array('controller' => 'moncontroller', 'action' => 'monaction'))
if (isset($item['url']['controller']) && $item['url']['controller'] !== '/') {
......@@ -65,7 +67,7 @@ class WebdpoMenuHelper extends AppHelper {
if (isset($item['url']) && ( $item['url'] != '#' )) {
$url = $item['url'];
if (is_array($url)) {
$url += array('plugin' => null);
$url += ['plugin' => null];
}
$content .= $this->Html->link(
......@@ -75,10 +77,12 @@ class WebdpoMenuHelper extends AppHelper {
$extra + ['escape'=>false]
). $sub;
} else if (!empty($sub)) {
$htmlOptions = array();
$htmlOptions = [];
if ($disabledTag == 'a') {
$htmlOptions['href'] = '#';
}
if ($level === 0) {
$caret = $this->Html->tag('span', '<!---->', ['class' => 'caret']);
$content .= $this->Html->tag($disabledTag, $key . $caret, ['class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'] + $htmlOptions) . $sub;
......@@ -88,7 +92,7 @@ class WebdpoMenuHelper extends AppHelper {
}
$liClass = ( empty($sub) ? '' : ($level === 0 ? 'dropdown' : 'dropdown-submenu') );
$return .= empty($content) ? '' : $this->Html->tag('li', $content, array('class' => $liClass));
$return .= empty($content) ? '' : $this->Html->tag('li', $content, ['class' => $liClass, 'title' => $title]);
}
}
$ulParams = $level === 0
......
......@@ -499,6 +499,7 @@
$items += [
'' => [
'class' => 'fa-question-circle fa-lg',
'title' => __d('default', 'default.titleFAQ'),
'url' => [
'controller' => 'articles',
'action' => 'faq',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment