Skip to content

Commit

Permalink
[CONF-663] finished
Browse files Browse the repository at this point in the history
  • Loading branch information
navihtot committed Jun 1, 2016
1 parent aae6ba1 commit 04ab800
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Renderer/FlatMenuRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ protected function renderItem(ItemInterface $item, array $options) {
//$html .= $this->format($item->getUri() ? $item->renderLink() : $item->renderLabel(), 'link', $item->getLevel());
$html .= $this->renderLink($item, $options);


// renders the embedded ul
$childrenClass = (array)$item->getChildrenAttribute('class');
$childrenClass[] = 'menu_level_' . $item->getLevel();
Expand All @@ -228,6 +229,7 @@ protected function renderItem(ItemInterface $item, array $options) {

$html .= $this->renderList($item, $childrenAttributes, $options);


// closing li tag
$html .= $this->format('</li>', 'li', $item->getLevel(), $options);

Expand Down Expand Up @@ -255,7 +257,6 @@ protected function applyUserRights(ItemInterface &$item, array $options) {
$display_normal = false;
if (!empty($rate_rights)) {
//if one of item rate rights is in user rate right, then display item normaly
//prd($options['user_rate']);
foreach ($rate_rights as $rate_right) {
if (isset($options['user_rate'][$rate_right]) && $options['user_rate'][$rate_right] == 1) {
$display_normal = true;
Expand All @@ -269,11 +270,15 @@ protected function applyUserRights(ItemInterface &$item, array $options) {
if (!empty($alt_uri)) {
$item->setUri($alt_uri);
}
else if (!empty($this->defaultOptions['default_rate_alt_uri'])) {
$item->setUri($this->defaultOptions['default_rate_alt_uri']);
}
//set item class for css style if its unavailable for rate
$item_class = $item->getAttribute('class');
if ($item_class != '') $item_class .= ' ';
$item_class .= 'rate-unavailable';
$item->setAttribute('class',$item_class);
$item->setExtra('ext:rate-unavailable', true);
}
}
}
Expand All @@ -297,7 +302,6 @@ protected function renderLink(ItemInterface $item, array $options = array()) {
} else {
$text = $this->renderSpanElement($item, $options);
}

return $this->format($text, 'link', $item->getLevel(), $options);
}

Expand Down Expand Up @@ -357,6 +361,9 @@ protected function renderLabel(ItemInterface $item, array $options) {
$label .= $this->escape($item->getLabel());
}

if (!empty($extendedOptions['rate-unavailable'])) {
$label .= '<i class="'.$this->defaultOptions['rate_unavailable_icon'].' rate-unavailable-icon"></i>';
}

return $label;
}
Expand Down

0 comments on commit 04ab800

Please sign in to comment.