Problem/Motivation
Regression from #2969136: Behavior settings should not include hidden styles on save.
How to reproduce:
- Install paragraphs collection demo
- Start creating a paragraphed node
- Add a container paragraph
The dropdown style selection is there even when not choosing the "Behaviors" js tab.
Proposed resolution
Use the group settings from the $form array provided to the \Drupal\paragraphs_collection\Plugin\paragraphs\Behavior\ParagraphsStylePlugin::buildBehaviorForm method.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | interdiff-3001207-6-9.txt | 1.5 KB | johnchque |
| #9 | style_always_visible-3001207-9.patch | 4.82 KB | johnchque |
| #9 | style_always_visible-3001207-9-test-only.patch | 2.43 KB | johnchque |
| #6 | interdiff-3001207-2-6.txt | 4.25 KB | johnchque |
| #6 | style_always_visible-3001207-6.patch | 4.54 KB | johnchque |
Comments
Comment #2
primsi commentedNot sure about tests here. We don't seem to have collection js tests yet.
Comment #3
berdirThe only reason we stopped just using $form is to fix some problems, lets check this with @mbo next week.
Comment #4
mbovan commented#3: Yes, we didn't want to produce any additional markup if there are no styles to select. That was the reason to switch away from
$formand use$build.Either we do this here for the style plugin only, or we append the plugin behavior form array in
Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget::formElement()as$element['behavior_plugins'][$plugin_id] += $plugin_form;?Related issues: #2971115: Do not print behavior form if there is nothing a plugin can do, #3002419: Base buildBehaviorForm should not add markup for plugins with no behavior form
Comment #5
johnchqueWorking on tests for this. :)
Comment #6
johnchqueI was checking the code of other plugins and it seems we always used the form variable to add all the plugin elements. I think is better to make them all equal to making it easier to change later. (e.g. not adding any markup at all if there are no plugins).
Comment #9
johnchqueMy bad. :(
Comment #12
berdirYes, lets revert that change for now, we do have test coverage now in case we decide to improve that later, then we could also add test coverage for the specific problem that solves in regards to the markup...