Skip to content

Commit

Permalink
MDL-31224 block_navigation: Fixed display of icons for node with an a…
Browse files Browse the repository at this point in the history
…ction_link action
  • Loading branch information
Sam Hemelryk committed Jan 20, 2012
1 parent 1aff7bb commit 5ab5e79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions blocks/navigation/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null,
$isexpandable = (empty($expansionlimit) || ($item->type > navigation_node::TYPE_ACTIVITY || $item->type < $expansionlimit) || ($item->contains_active_node() && $item->children->count() > 0));
$isbranch = $isexpandable && ($item->children->count() > 0 || ($item->has_children() && (isloggedin() || $item->type <= navigation_node::TYPE_CATEGORY)));

$hasicon = ((!$isbranch || $item->type == navigation_node::TYPE_ACTIVITY )&& $item->icon instanceof renderable);
$hasicon = ((!$isbranch || $item->type == navigation_node::TYPE_ACTIVITY || $item->type == navigation_node::TYPE_RESOURCE) && $item->icon instanceof renderable);

if ($hasicon) {
$icon = $this->output->render($item->icon);
$content = $icon.$content; // use CSS for spacing of icons
} else {
$icon = '';
}
$content = $icon.$content; // use CSS for spacing of icons
if ($item->helpbutton !== null) {
$content = trim($item->helpbutton).html_writer::tag('span', $content, array('class'=>'clearhelpbutton'));
}
Expand All @@ -57,6 +59,7 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null,
} else if ($item->action instanceof action_link) {
//TODO: to be replaced with something else
$link = $item->action;
$link->text = $icon.$link->text;
$link->attributes = array_merge($link->attributes, $attributes);
$content = $this->output->render($link);
$linkrendered = true;
Expand Down

0 comments on commit 5ab5e79

Please sign in to comment.