/**
  * Fetch the html code to display the field value in artifact
  *
  * @param Tracker_Artifact                $artifact         The artifact
  * @param Tracker_Artifact_ChangesetValue $value            The actual value of the field
  * @param array                           $submitted_values The value already submitted by the user
  *
  * @return string
  */
 protected function fetchArtifactValue(Tracker_Artifact $artifact, Tracker_Artifact_ChangesetValue $value = null, $submitted_values = array())
 {
     $html = '';
     $content = '';
     if ($value) {
         $format = $value->getFormat();
     } else {
         $default_value = $this->getDefaultValue();
         $format = $default_value['format'];
     }
     if (!empty($submitted_values) && is_array($submitted_values[0]) && isset($submitted_values[0][$this->getId()])) {
         $content = $submitted_values[0][$this->getId()]['content'];
         $format = $submitted_values[0][$this->getId()]['format'] == Tracker_Artifact_ChangesetValue_Text::HTML_CONTENT ? Tracker_Artifact_ChangesetValue_Text::HTML_CONTENT : Tracker_Artifact_ChangesetValue_Text::TEXT_CONTENT;
     } elseif ($value != null) {
         $content = $value->getText();
     }
     $hp = Codendi_HTMLPurifier::instance();
     $html .= '<input type="hidden"
                      id="artifact[' . $this->id . ']_body_format"
                      name="artifact[' . $this->id . ']_body_format"
                      value="' . $format . '" />';
     $html .= '<textarea id = field_' . $this->id . ' class="user-mention"
                         name="artifact[' . $this->id . '][content]"
                         rows="' . $this->getProperty('rows') . '"
                         cols="' . $this->getProperty('cols') . '"
                         ' . ($this->isRequired() ? 'required' : '') . '
                         >';
     $html .= $hp->purify($content, CODENDI_PURIFIER_CONVERT_HTML);
     $html .= '</textarea>';
     return $html;
 }