From d7da41b78944340ddfcdeb438265d15a79bb6cad Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 5 Mar 2016 17:04:13 +0100 Subject: [PATCH] PropertyModifierSubstring: fix erraneous form fields --- .../PropertyModifierSubstring.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/library/Director/PropertyModifier/PropertyModifierSubstring.php b/library/Director/PropertyModifier/PropertyModifierSubstring.php index 1cffbfa6..e55d4a8a 100644 --- a/library/Director/PropertyModifier/PropertyModifierSubstring.php +++ b/library/Director/PropertyModifier/PropertyModifierSubstring.php @@ -9,19 +9,25 @@ class PropertyModifierSubstring extends PropertyModifierHook { public static function addSettingsFormFields(QuickForm $form) { - $form->addElement('text', 'pattern', array( - 'label' => 'Regex pattern', - 'required' => true, + $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')); } }