PropertyModifierSubstring: fix erraneous form fields

This commit is contained in:
Thomas Gelf 2016-03-05 17:04:13 +01:00
parent d0250dc312
commit d7da41b789

View File

@ -9,19 +9,25 @@ class PropertyModifierSubstring extends PropertyModifierHook
{
public static function addSettingsFormFields(QuickForm $form)
{
$form->addElement('text', 'pattern', array(
'label' => 'Regex pattern',
$form->addElement('text', 'start', array(
'label' => 'Start',
'required' => true,
'description' => sprintf(
$form->translate(
'Please see %s for detailled instructions of how start and and work'
),
'http://php.net/manual/en/function.substr.php'
)
));
$form->addElement('text', 'replacement', array(
'label' => 'Replacement',
$form->addElement('text', 'length', array(
'label' => 'End',
'required' => true,
));
}
public function transform($value)
{
return substr($value, $this->settings['start'], $this->settings['end'] - $this->settings['start']);
return substr($value, $this->getSetting('start'), $this->getSetting('length'));
}
}