Closed (fixed)
Project:
Paragraphs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 May 2020 at 15:41 UTC
Updated:
9 Sep 2020 at 11:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
johnchqueThis should be working. :)
Comment #3
berdirLets add some test for this.
Comment #4
johnchqueFirst tests. Let's give a try. :)
Comment #6
johnchqueMoving the tests. This time with Content moderation. :)
I've noticed that the tests of Library and Content Moderation are using the Legacy Widget. Opening a new issue for that: #3142680: Switch field widget for library tests to stable.
Comment #7
berdirI think we can re-use the existing class here for most things. a diff between the two files shows it is identical except that extra icon that we're adding.
So try to do an extends ParagraphsSummaryFormatter here and then call parent::build() and then you only need to add this extra visibility icon. IMHO you could even skip the foreach loop, as we know that this is for the library item base field which has cardinality 1 and so only has delta 0.
isSubclassOf is deprecated, looks like this was copied from an older version of the other summary class.
I first thought we can just drop this with the changed parent, but actually, that would make this formatter show up on all paragraph fields, we don't want that. WE only want it on the paragraph field on library items. So instead of this, check getTargetEntityTypeId() of $field_definition and the field name to only allow this being used on this specific field.
Comment #8
johnchqueAddressing suggestions!
Comment #9
berdirNeeds a reroll as another issue added test logic in the same place.
Comment #10
mbovan commentedRerolled.
Comment #12
mbovan commentedNot sure if something has changed in Paragraphs default configuration since #8 to result in test #10 fails...
Fixed and improved tests.
Comment #13
berdirHm, possibly the behavior change is the published-by-default change that the other issue did that this conflicted with? Test looks good to me, committed.