Fix that an object's notes and action url label is escaped twice

fixes #10218
This commit is contained in:
Johannes Meyer 2015-09-28 09:05:17 +02:00
parent d4c1ca9e18
commit d627f419ef
3 changed files with 43 additions and 3 deletions

View File

@ -36,6 +36,13 @@ class NavigationItemRenderer
*/
protected $internalLinkTargets;
/**
* Whether to escape the label
*
* @var bool
*/
protected $escapeLabel;
/**
* Create a new NavigationItemRenderer
*
@ -126,6 +133,29 @@ class NavigationItemRenderer
return $this->item;
}
/**
* Set whether to escape the label
*
* @param bool $state
*
* @return $this
*/
public function setEscapeLabel($state = true)
{
$this->escapeLabel = (bool) $state;
return $this;
}
/**
* Return whether to escape the label
*
* @return bool
*/
public function getEscapeLabel()
{
return $this->escapeLabel !== null ? $this->escapeLabel : true;
}
/**
* Render the given navigation item as HTML anchor
*
@ -144,7 +174,9 @@ class NavigationItemRenderer
);
}
$label = $this->view()->escape($item->getLabel());
$label = $this->getEscapeLabel()
? $this->view()->escape($item->getLabel())
: $item->getLabel();
if (($icon = $item->getIcon()) !== null) {
$label = $this->view()->icon($icon) . $label;
}

View File

@ -16,7 +16,11 @@ foreach ($object->getActionUrls() as $i => $link) {
'Action ' . ($i + 1) . $newTabInfo,
array(
'url' => $link,
'target' => '_blank'
'target' => '_blank',
'renderer' => array(
'NavigationItemRenderer',
'escape_label' => false
)
)
);
}

View File

@ -26,7 +26,11 @@ if (! empty($links)) {
$this->escape($link) . $newTabInfo,
array(
'url' => $link,
'target' => '_blank'
'target' => '_blank',
'renderer' => array(
'NavigationItemRenderer',
'escape_label' => false
)
)
);
}