addElement('text', 'domain', array( 'label' => 'Domain name', 'description' => $form->translate('The domain name you want to be stripped'), 'required' => true, )); } public function getName() { return 'Strip a domain name'; } public function transform($value) { $domain = preg_quote(ltrim($this->getSetting('domain'), '.'), '/'); return preg_replace( '/\.' . $domain . '$/', '', $value ); } }