mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
Fix that an object's notes and action url label is escaped twice
fixes #10218
This commit is contained in:
parent
d4c1ca9e18
commit
d627f419ef
@ -36,6 +36,13 @@ class NavigationItemRenderer
|
|||||||
*/
|
*/
|
||||||
protected $internalLinkTargets;
|
protected $internalLinkTargets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to escape the label
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $escapeLabel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new NavigationItemRenderer
|
* Create a new NavigationItemRenderer
|
||||||
*
|
*
|
||||||
@ -126,6 +133,29 @@ class NavigationItemRenderer
|
|||||||
return $this->item;
|
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
|
* 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) {
|
if (($icon = $item->getIcon()) !== null) {
|
||||||
$label = $this->view()->icon($icon) . $label;
|
$label = $this->view()->icon($icon) . $label;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,11 @@ foreach ($object->getActionUrls() as $i => $link) {
|
|||||||
'Action ' . ($i + 1) . $newTabInfo,
|
'Action ' . ($i + 1) . $newTabInfo,
|
||||||
array(
|
array(
|
||||||
'url' => $link,
|
'url' => $link,
|
||||||
'target' => '_blank'
|
'target' => '_blank',
|
||||||
|
'renderer' => array(
|
||||||
|
'NavigationItemRenderer',
|
||||||
|
'escape_label' => false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,11 @@ if (! empty($links)) {
|
|||||||
$this->escape($link) . $newTabInfo,
|
$this->escape($link) . $newTabInfo,
|
||||||
array(
|
array(
|
||||||
'url' => $link,
|
'url' => $link,
|
||||||
'target' => '_blank'
|
'target' => '_blank',
|
||||||
|
'renderer' => array(
|
||||||
|
'NavigationItemRenderer',
|
||||||
|
'escape_label' => false
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user