Skip to content

Commit

Permalink
fix(textareafield): update escaping / line ending conversion to match…
Browse files Browse the repository at this point in the history
… GLPI 10
  • Loading branch information
btry committed Mar 17, 2022
1 parent 7de8b01 commit 5b6bc51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions inc/field/textareafield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class TextareaField extends TextField

public function showForm(array $options): void {
$template = '@formcreator/field/' . $this->question->fields['fieldtype'] . 'field.html.twig';
$this->question->fields['default_values'] = Html::entities_deep($this->question->fields['default_values']);
$this->deserializeValue($this->question->fields['default_values']);
$parameters = $this->getParameters();
TemplateRenderer::getInstance()->display($template, [
Expand All @@ -71,7 +70,7 @@ public function getRenderedHtml($domain, $canEdit = true): string {
$id = $this->question->getID();
$rand = mt_rand();
$fieldName = 'formcreator_field_' . $id;
$value = nl2br(__($this->value, $domain));
$value = $this->value;
$html = '';
$html .= Html::textarea([
'name' => $fieldName,
Expand Down Expand Up @@ -183,7 +182,6 @@ public function prepareQuestionInputForSave($input): array {
if (!$success) {
return [];
}
$this->value = Toolbox::stripslashes_deep(str_replace('\r\n', "\r\n", $input['default_values']));

// Handle uploads
$key = 'formcreator_field_' . $this->question->getID();
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,4 @@ function plugin_formcreator_redirect() {
Html::redirect($issue->getFormURLWithID($issue->getID()) . '&tickets_id=' . $itemTicket->fields['tickets_id']);
}
}
}
}

0 comments on commit 5b6bc51

Please sign in to comment.