Skip to content

Commit

Permalink
Issue #407: Convert newlines to br when importing data dictionary c…
Browse files Browse the repository at this point in the history
…olumns
  • Loading branch information
lkmorlan committed Apr 22, 2024
1 parent ba510a7 commit 84ab7d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion html/modules/custom/bc_dc/src/Form/BcDcAddColumnsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ public function submitForm(array &$form, FormStateInterface $form_state): void {
}
elseif (isset($row[$key]) && strlen($row[$key])) {
$paragraph_fields['field_' . $field] = [
'value' => $row[$key],
'value' => nl2br($row[$key]),
'format' => 'basic_html',
];
}
Expand Down
3 changes: 2 additions & 1 deletion html/modules/custom/bc_dc/tests/files/test-valid.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
column_name column_size column_type column_description
Name tsv 50 integer <p><strong>Column description</strong></p>
Name tsv 50 integer "<p><strong>Column
description</strong></p>"
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ public function test(): void {
];
$this->submitForm($edit, 'Publish');
// Column description is displayed with HTML tags.
$this->assertSession()->elementExists('xpath', '//div[contains(@class, "field--name-field-column-description")]/div/p/strong[text() = "Column description"]');
$this->assertSession()->elementExists('xpath', '//div[contains(@class, "field--name-field-column-description")]/div/p/strong[text() = "Column"][br]');

// Anonymous has no access to data_set build page.
$this->drupalLogout();
Expand Down

0 comments on commit 84ab7d0

Please sign in to comment.