Problem/Motivation
We have a summary with icons now.
However, only the text summary can be provided by plugins.
It's the plugins that extend Paragraphs with functionality where text representation is inaccessible.
The lock icon on the left side already should be provided by the lock plugin, while the lock on the right (instead of the edit button) side is a plain fact.
Common things that should be iconised:
- Layout (plugin)
- Style (plugins)
- Plugin type (A carousel, ..)
Proposed resolution
Add a new method so plugins can provide icons.
Extend a test plugin to provide e.g. a blod icon:
modules/paragraphs/src/Tests/Experimental/ParagraphsExperimentalBehaviorsTest.php
modules/paragraphs/tests/modules/paragraphs_test/src/Plugin/paragraphs/Behavior/TestBoldTextBehavior.php
\Drupal\paragraphs\Tests\Experimental\ParagraphsExperimentalBehaviorsTest::testCollapsedSummary
This implementation will remove the left lock icon from Paragraphs. Paragraphs Collection will bring it back with implementing the method.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#14 | plugins-info-items-support-2903489-14-interdiff.txt | 1.79 KB | Berdir |
#14 | plugins-info-items-support-2903489-14.patch | 24.84 KB | Berdir |
| |||
#12 | plugins-info-items-support-2903489-11.patch | 24.79 KB | pivica |
#12 | interdiff-2903489-9-11.txt | 1.47 KB | pivica |
#9 | plugins-info-items-support-2903489-9.patch | 24.79 KB | pivica |
Comments
Comment #2
miro_dietikerFrom #2904402-3: Improvements in UI
Ideas about when the lock inside the summary should be displayed:
Comment #3
pivica CreditAttribution: pivica at MD Systems GmbH commentedHere is a first patch proposal.
ParagraphsBehaviorInterface has a new method settingsInfo() method which is similar to settingsSummary() and it allows behaviour plugins to return an array of info items.
ParagraphInterface has a new method getInfo() which for now adds child count as a badge info item and then query all behaviour plugins for additional info items. With this, we can also close #2903491: Display Paragraphs child count in summary as badge as a duplicate now because we have child count badge support now.
And we also addressed all the issues in comment #2.
Tests are updated.
For this patch to work and be tested properly we also need a patch for a locking behaviour plugin #2904637: Convert lockable plugin to use new settingsInfo() instead of settingsSummary().
Attaching screenshots of a new look, notice that we also changed the colour of lock icon from blue to grey as per discussion in #2904402-3: Improvements in UI.
Regular editor (without permissions to change locked items):
Power editor (with permission to lock items and change them):
Comment #5
pivica CreditAttribution: pivica at MD Systems GmbH commentedHere is updated patch that is fixing broken tests.
However the
Is not related to this changes. My guess is that probably something changed in core related to entity reference field or something else and now when you delete referenced node the reference will also be deleted in the parent node.
Comment #7
miro_dietikerI triggered retest of PHP7 + MySQL 5.5 + Core 8.4 and it passed:
https://www.drupal.org/pift-ci-job/749628
So the issue seems to be specific to this patch.
Comment #8
Berdirthis is called getInfo() but it returns $icons. getInfo() is a very generic name, why not call it getIcons() or getSummaryIcons() ?
same for this method.
related to naming, also needs better description/explanation of what the method returns (basically a list of render arrays that will be rendered as icoons)
same here, but the descriptions above are already better, we could also add a @see here to the ParagraphsInterface method.
classes are a bit strange, the above two makes sense as it is the paragraphs *type* title/icon, but this is about the paragraph, not the paragraph type.
And again the point that info here is very generic and unclear, I also see now where getInfo() is coming from.
not a problem of this issue, but the fact that we check the existense of the paragraph type here is kinda weird, things are going to end badly if that doesn't exist. Lots of things are inside that check and many others are not, seems pretty random. but fine, lets keep that for now.
Comment #9
pivica CreditAttribution: pivica at MD Systems GmbH commentedHere is a new patch (build against latest dev), points 1 to 5 from comment #8 are done. I've also change classes paragraph-type-title to just paragraph-type and paragraph-type-top to paragraph-top for experimental widget, make more sense too me.
> not a problem of this issue, but the fact that we check the existence of the paragraph type here is kinda weird
If you are referring to:
yeah seems to me this if is totally necessary because it is checking something that can not happen. Anyway, this is old code, we create follow-up for this?
I triggered retest of PHP7 + MySQL 5.5 + Core 8.4 and it passed:
https://www.drupal.org/pift-ci-job/749628
So the issue seems to be specific to this patch.
@berdir said he will check this when he find's time, probably he still didn't do it, will ping him about this.
Comment #10
pivica CreditAttribution: pivica at MD Systems GmbH commented@berdir, what do you think should we also rename paragraphs_info_icon theme to paragraphs_icon? I know here we have plural and in class names single - i guess classes should also be plural, but i think we have a separate issue for this already.
Comment #12
pivica CreditAttribution: pivica at MD Systems GmbH commentedFixed new failed tests from the last patch.
Comment #14
BerdirFixed the tests.
Comment #15
pivica CreditAttribution: pivica at MD Systems GmbH commentedDiscussed comment #10 also with @berdir, he is OK we leave paragraphs_info_icon theme name. So we are good to go with this.
Comment #17
miro_dietikerOK cool, committed. Cool to have the badge thing in as well! :-)