public function applyFormatting($value) { if (isset($this->{'text-formatter'}) and $this->{'text-formatter'} != TextFormatter::NONE) { try { $formatter = TextFormatter::loadFromHandle($this->{'text-formatter'}); $result = $formatter->run($value); $result = preg_replace('/&(?![a-z]{0,4}\\w{2,3};|#[x0-9a-f]{2,6};)/i', '&', $result); return $result; } catch (Exception $e) { // Problem loading the formatter // TODO: Decide is we should be handling this better. } } return General::sanitize($value); }