mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
parent
ed65052982
commit
4a4fbaee8e
33
library/Icinga/Web/Form/Decorator/Help.php
Normal file
33
library/Icinga/Web/Form/Decorator/Help.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Icinga\Web\Form\Decorator;
|
||||||
|
|
||||||
|
use Icinga\Application\Icinga;
|
||||||
|
use Zend_Form_Decorator_Abstract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A decorator that will display the description as a help icon
|
||||||
|
*/
|
||||||
|
class Help extends Zend_Form_Decorator_Abstract
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Render a description and show it as a help icon
|
||||||
|
*
|
||||||
|
* @param string $content
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function render($content = '')
|
||||||
|
{
|
||||||
|
$element = $this->getElement();
|
||||||
|
$description = $element->getView()->escape($element->getDescription());
|
||||||
|
|
||||||
|
if (! empty($description)) {
|
||||||
|
$helpIcon = Icinga::app()->getViewRenderer()->view->icon('help', $description);
|
||||||
|
return $helpIcon . $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user