2015-07-23 14:29:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\PropertyModifier;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Web\Hook\PropertyModifierHook;
|
|
|
|
|
|
|
|
class PropertyModifierReplace PropertyModifierHook
|
|
|
|
{
|
|
|
|
|
2015-07-23 14:42:53 +02:00
|
|
|
public static function addSettingsFormFields(QuickForm $form)
|
|
|
|
{
|
|
|
|
$form->addElement('text', 'string', array(
|
|
|
|
'label' => 'Search string',
|
|
|
|
'required' => true,
|
|
|
|
));
|
|
|
|
$form->addElement('text', 'replacement', array(
|
|
|
|
'label' => 'Replacement',
|
|
|
|
'required' => true,
|
|
|
|
));
|
|
|
|
return $form;
|
|
|
|
}
|
|
|
|
|
2015-07-23 14:29:15 +02:00
|
|
|
public function transform($value)
|
|
|
|
{
|
|
|
|
return str_replace($this->settings['string'], $this->settings['replacement'], $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|