Problem/Motivation
The collapsed summary now only shows a summary of the first child of a container.
That's a good start, but it is misleading as it looks like there is only one child.
Related discussion:
For instance the drag and drop mode shows a summary AND also always shows the childrens below, indented. Repeating the children on the parent would lead do weird duplication. Also "container only" are likely to have plugins enabled and thus if no content fields, the summary would simply tell styles or grid settings chosen. And if none, then an empty summary is perfectly what i expect.
Proposed resolution
Either combine multiple children or at least display a child count.
If the closed mode will only hide the child content fields, but display child paragraphs fields, the situation would be different.
But in that case, child paragraphs fields would be excluded completely from the closed summary.
Since we are not sure what of these two options are the long term goal, we should implement both. Either use a setting or define a second closed mode. Add a new argument to Summary method, if ERR children should be part of the summary or not.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#47 | consider_container-2852001-47.patch | 12.59 KB | Ginovski |
#47 | interdiff-2852001-45-47.txt | 1001 bytes | Ginovski |
#45 | consider_container-2852001-45.patch | 12.84 KB | Ginovski |
#45 | interdiff-2852001-43-45.txt | 1.16 KB | Ginovski |
#43 | consider_container-2852001-43.patch | 12.78 KB | Ginovski |
Comments
Comment #2
thenchev CreditAttribution: thenchev commentedComment #3
miro_dietikerSo this is postponed on the move i guess.
Comment #4
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedReturning to active since #2857112: Add summary method into paragraph entity is committed
Comment #5
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedComment #6
thenchev CreditAttribution: thenchev commentedIf I understand correctly then the problem is with the nested paragraph so i updated it to display all referenced paragraphs. Also updated the getTextSummary() in Paragraphs to handle multivalue text field. Is this something we also want?
Comment #7
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedYes, the problem is with nested paragraphs. In Paragraph.php we have a summary method that recursively generates a summary. The challenge is how to make this nice from UX perspective.
If I understood it right, @miro_dietiker suggests two possible solutions:
Both should be implemented for now and which one is used should be configurable on the widget config.
Comment #8
miro_dietikerI don't want added configurability now. But i want a text representing the count, possibly first:
Example "5 Children". And then the summary of each.
We will use either by passing in additional arguments to functions. If we show the children in the summary depends if the child is separately displayed or not. This depends and might change with open / closed / drag & drop modes and more.
Comment #9
thenchev CreditAttribution: thenchev commentedHere is the initial patch and some thoughts.
1. Removed the configurability but i can add it to widget settings if we decide.
2. In the first iteration my summary was like "1 Text paragraph, 2 Image paragraphs, 1 Container". It grouped the paragraph types and used that as a summary.
3. I don't know what the plan for further development but are we considering to use maybe image representations for paragraph types. So the summary for the container paragraphs could be: "1 [text paragraph image], 2 [image paragraph image], 1 [container image]" and hovering on the images we can show summary of the individual paragraphs?
4. Here are some images of how containers look:
Here is the top container:
This is the container inside the top container:
How do we want to display summary for the container inside the container? Separate with [] or some indicator that is a summary of a container inside.
Comment #11
thenchev CreditAttribution: thenchev commentedThis should fix some test fails.
Comment #13
thenchev CreditAttribution: thenchev commentedlast fail
Comment #14
miro_dietikerWe can not vary the return type based on an argument. What we return should always be of the same type.
Unsure about outputting the paragraph types and sure also "Children". The thing is, the summary intentionally also skips field labels so the effective field values are getting visible. I think we should skip all these labels in the current design and think about outputting some when we have icons.
But in order to continue, we need all the follow-up issues created first before someone can commit this. I think even we need a new parent META that describes the general goal of how the summary should evolve and specific child issues that care about showing plugin icons, paragraph type icons for children with counters, ...
Comment #15
thenchev CreditAttribution: thenchev commentedCreated meta issue for discussion #2862083: [META] Improve paragraphs summary. And continue to improve this...
Comment #16
thenchev CreditAttribution: thenchev commentedComment #17
thenchev CreditAttribution: thenchev commentedsorry wrong image. this one is correct.
Comment #18
thenchev CreditAttribution: thenchev commentedNoticed that when the summary is closed by default the count is wrong so fixed that and will work on adding some more options to the getSummary() in paragraphs.
Comment #19
thenchev CreditAttribution: thenchev commentedAdded more options for the summary: allowed bundles, number of allowed summaries and if the behavior summaries should be shown.
Now that we display count of how many children there are what would be the best way to show everything when we limit the number of summaries?
Here are some options how to display closed summary if for example we have 5 children but the limit is to show 2 summaries:
1) 2 children *show 2 summaries* // Show wrong count, probably not a good option.
2) More then 2 children *show 2 summaries* // This is how right now it is displayed.
3) 5 children *show 2 summaries* // Another option
Also is this going to be relevant when we change to icons?
Comment #21
thenchev CreditAttribution: thenchev commentedComment #23
thenchev CreditAttribution: thenchev commentedthe bot is crazy
Comment #24
miro_dietikerOK, you add new optional arguments to avoid breaking the contract.
But i requested other options we need to add in other issues - such as a recursion flag or keys of information that is covered in icons so the summary can skip it.
For less contract breaking, we proposed to have an $options array where we can pass in things with magic keys to also cover the other concepts.
I like the image showing "1 Children | and the summary..." but the vertical line got lost in the implementation?
Comment #25
BerdirYes, I already suggested on the original issue to add a empty $options argument so we can add additional options later on. I guess we now have to change the API, which is a bit unfortunate but only dev - > dev and not yet in a release.
Comment #26
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commented1. Added options array instead of multiple arguments
2. Added a case for an empty nested.
3. Configured test accordingly.
Not sure why the edit button lowered a bit.
Comment #28
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedFixed test fail and some minor changes.
Still has the problem with the lowered edit button.
Edit: This problem exists only in firefox, this issue does not affect it, maybe it is due some latest commits.
Comment #29
toncic CreditAttribution: toncic at MD Systems GmbH commentedOnly small stuff.
I am thinking here to use $options = NULL instead of $options = [];
I don't think we want grouping conditions.
I think is better to use $this->t();
Beside these, everything works fine.
Comment #30
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAddressed #29:
1. Fixed the docs with array instead of NULL as default
2. Removed grouping conditions
3. $this->t was not available in the paragraph class
Comment #31
miro_dietikerThat's not the proper use of a t().
A limit is to make sure things don't take too much space. It could lead to some "..." but it should never push a valuable summary text with meaningless prepended words.
Both allowed bundles and count_limit are significantly pushing code complexity here.
But you neither use those nor test them. We don't want to have code complexit for hidden unneeded and undocumented features.
Comment #32
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commented1. Removed count limit and allowed bundles.
2. With 1, description for more than count_limit got removed as well.
3. Fixed the t(), maybe... I'm not sure if I did this correctly.
Also, a suggestion:
We could use 'elements' instead of 'children' in the summary
Comment #33
miro_dietikerMissing patch.
Comment #34
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedThe patch :)
Comment #35
miro_dietikerNeeds reroll after #2852126: Improve paragraphs display in the library overview
Comment #36
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedWhat are this options? This should be documented on the inteface for getSummary. The docblock for getNestedSummary can point to the getSummary on inteface for more information.
Shouldn't this new options be reflect on the formatter settings too? Should be that part of a follow up?
Comment #37
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAddressed #36.
About the formatter, yes, that will be a follow-up. (I suppose there will be one for the test fix and one to add an additional option for the length of the summary (the truncate on 150 characters is not optimal in the library)).
Comment #38
miro_dietikerI guess these two cases are also present on other locations of the code. Usually, we should unify these conditions so code doesn't need to check it..? Don't know if it is possible.
First time you check for ParagraphsInterface, second time not.
This patch results in ALWAYS recursing deep over all children. In a setup with many nested paragraphs, it will significantly degrade performance, even if the children are collapsed. The subject asks to CONSIDER the children. We should not recurse if it is not needed. And i guess we should look at profiling data.
To limit recursion depth, we can not blindly pass the options array forward. Certain elements in it will need to be filtered / updated i guess. I was not sure if we should put the depth information into an argument?
Comment #39
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commented1. Unified the two cases from #38 comment and checked for ParagraphsInterface accordingly.
2.Added new option depth_limit to limit the nesting summary (defaults to 1).
3.Added kernel test for the options array testing.
Comment #40
BerdirI need this for #2825575: Introduce a Drag & Drop Mode
I think it would be more readable to do this on the call to this, where you can just do a 'depth_limit' => $depth_limit - 1
this can be simplified:
* foreach $get($field_name) as $item
* then $item->entity and so on. the original patch also on purpose did a ->entity check instead of id and then it automatically loads, so you can drop the whole loadRevision() fallback.
* $paragraphs_entity => $paragraph or maybe $entity bcause we don't really know for sure if it's a paragraph yet at this point.
I'm confused about this summary count thing. it adds quite a bit of complexity and it seems to be counting different kinds of children depending on depth?
if we get the summary count from the children, then we count basically each field, including text fields a child? that doesn't make sense? and we count possibly multivalue paragraphs then again as just one child.
My recommendation would be to always just look at the actual, direct children and not the grand children. Pretty sure this causes more confusion than it actually provides something useful?
docs are unclear, doesn't say what is the default and what does "enforces behavior settings in summary" even mean? :)
Comment #41
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedAddressed #40
Extended text coverage with nested summary.
Comment #43
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedFixed test.
Comment #44
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedThis needs a re-roll, apart from that looks quite ok.
Comment #45
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedRerolled and fixed tests.
Comment #46
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedJust two more things.
Is this still used somewhere?
Or NULL if the summary is empty.
Comment #47
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commented1. This wasn't used, so I removed it for now, we can add it, if we need it for extended summary.
2. Change the description accordingly.
Comment #49
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedCommitted, thanks. Please add the follow up to make this configurable on the widget, then this can be moved to Fixed.
Comment #50
Ginovski CreditAttribution: Ginovski at MD Systems GmbH commentedCreated follow-up #2890246: Make container summary configurable, setting this to fixed.