Problem/Motivation
Users sometimes want to use inline HTML in uploaded tables.
Steps to reproduce
Proposed resolution
Allow cell content to be rendered as #markup
Remaining tasks
User interface changes
This could be added as an optional configuration, we have a patch to just turn it on across the board.
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| task-DC-1540-allow-html-data-table.patch | 679 bytes | mciver87 |
Issue fork file_table_formatter-3359118
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
zengenuity commentedI think if we add this, it shouldn't use a #markup render array. That's too permissive. While that is filtered for XSS, it's not filtered for other restricted tags on the site, nor are any filters run to make sure the HTML is valid. You could have unclosed tags, for example, that would break the site formatting.
I think to add this, we would need two things:
1. Switch to using #processed_text instead of #markup.
2. Add a configuration option on the field formatter that allows you to select whether the contents of the CSV file should be rendered as plain text or formatted text. If formatted text is chosen, then you should be required to pick what text format to use from the available text formats on the website. That would then be used as the #format value when we render the results with #processed_text. We can use #plain_text if the plain text option is chosen.
Comment #3
geoffreyr commentedI've got a case where I have a CSV with a lot of line breaks in the cells that I'd like to convert to HTML
<br />markup (nl2brstyle). This feature might allow for what I want to achieve, so I'll see if it's possible to render out the cells with a text filter set.Comment #5
geoffreyr commentedMR available for review.
Comment #7
zengenuity commentedThis looks good. Merged.
Thanks!