Skip to content

Commit

Permalink
Remove br from save and add to presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
iszmais committed Jul 2, 2024
1 parent cc62bdd commit 0ae0ca8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function listRecords(bool $use_tableview_filter = false): void
if ($ilSetting->get('advanced_editing_javascript_editor')) {
$desc = "<div class='ilDclTableDescription'>" . $desc . "</div>";
} else {
$desc = "<div class='ilDclTableDescription'>" . nl2br(ilUtil::stripSlashes($desc)) . "</div>";
$desc = "<div class='ilDclTableDescription'>" . nl2br($this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($desc)) . "</div>";
}
}
$this->tpl->setContent($desc . $list->getHTML());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function parseValue($value)
if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_TEXTAREA)
&& !$this->getField()->getProperty(ilDclBaseFieldModel::PROP_URL)
) {
return nl2br($value);
return $value;
}

return $value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getHTML(bool $link = true, array $options = []): string
'renderRecord'
) . '">' . $value . '</a>';
} else {
$html = (is_array($value) && isset($value['link'])) ? $value['link'] : $value;
$html = (is_array($value) && isset($value['link'])) ? $value['link'] : nl2br($value);
}

if (!$html) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,16 @@ public function step_10(): void
$this->db->addIndex('il_dcl_tfield_set', array('table_id'), 'i4');
}
}

public function step_11(): void
{
$this->db->manipulateF(
'UPDATE il_dcl_stloc1_value v '.
'INNER JOIN il_dcl_record_field rf ON rf.id = v.record_field_id ' .
'INNER JOIN il_dcl_field f ON f.id = rf.field_id ' .
'SET v.value = REPLACE(v.value, "<br />", "\r\n") WHERE f.datatype_id = %s',
[ilDBConstants::T_INTEGER],
[ilDclDatatype::INPUTFORMAT_TEXT]
);
}
}

0 comments on commit 0ae0ca8

Please sign in to comment.