Problem/Motivation

We could allow field summary from external modules/profiles for specific definition.

Proposed resolution

Add an alter hook to the summary function.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Ginovski created an issue. See original summary.

ginovski’s picture

StatusFileSize
new1.2 KB

Added the alter hook

ginovski’s picture

Status: Active » Needs review
ginovski’s picture

Assigned: Unassigned » ginovski
StatusFileSize
new1.81 KB

Small change in function parameters

primsi’s picture

berdir’s picture

Status: Needs review » Needs work
+++ b/src/Entity/Paragraph.php
@@ -494,6 +495,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface, EntityN
 
+    \Drupal::moduleHandler()->alter('paragraphs_field_summary', $field_definitions, $summary);
     $collapsed_summary_text = implode(', ', $summary);

we should pass in the paragraph, not just the fields.

Also, the man argument should be the first, in this case the sumary.

And the question is how do you actually figure out what is where in that summary?

We should possibly conside to use keys, e.g. field names, so you can actually alter things in a useful way.

berdir’s picture

Status: Needs work » Closed (duplicate)

Actually, we have an issue already and someone started to work on it: #2868252: Consider adding a hook to Paragraphs::getSummary

Lets continue there. Did not review yet.