Problem/Motivation

When showing the summary, we can get text that can be only be tags with no context. If we have useful information, we might lose it if we do not display it.

Proposed resolution

If there is if the result of strip_tags() is empty, we'd fall back to a escaped version of the HTML tags, so it should something like "

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yongt9412 created an issue. See original summary.

johnchque’s picture

Status: Active » Needs review
FileSize
538 bytes

This should work, working on tests now. :)

Status: Needs review » Needs work

The last submitted patch, 2: show_raw_summary-3008364-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

johnchque’s picture

Status: Needs work » Needs review
FileSize
2.22 KB
1.58 KB

Ok, adding tests, not sure if HEAD is failing. Seems demo is used on some tests. We should remove that.

Status: Needs review » Needs work

The last submitted patch, 4: show_raw_summary-3008364-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

miro_dietiker’s picture

Use methods like htmlspecialchars, not selfcoded replaces.

johnchque’s picture

Status: Needs work » Needs review
FileSize
2.22 KB
426 bytes

That's true. Thanks.

johnchque’s picture

Fails should be fixed in #3008584: Remove demo from tests :)

miro_dietiker’s picture

Status: Needs review » Needs work
+++ b/src/Entity/Paragraph.php
@@ -503,7 +503,10 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface {
-    return strip_tags($collapsed_summary_text);

Sorry, i think this should go into the getTextSummary() method and the raw text also need to be truncated like usual for text fields.

Currently there wouldn't be any summary from such a text field as soon as a behavior setting is applied, making the summary as unclear as before. It's really a fallback for an empty text field.

We will work on displaying behavior summaries differently soon and keep this separated from the text summary.

johnchque’s picture

Status: Needs work » Needs review
FileSize
2.42 KB
656 bytes

Right, updating. :)

miro_dietiker’s picture

Did some rewrite as i don't want to drop the parent strip_tags to protect from bad content of other summary components like labels...

Ready?

miro_dietiker’s picture

Status: Needs review » Fixed

Awesome, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.