Problem/Motivation
View UI edit form provides smaller Dropbutton by providing extra CSS in its admin styling.
The problem is that it is impossible to re-use the smaller variant of Views UI Dropbutton without repeating the CSS.
Proposed resolution
Provide a way (by an optional property) to specify Dropbutton variants (e.g. in the same way that Button variants provided).
Example:
$form['actions']['extra_actions'] = array(
'#type' => 'dropbutton',
'#dropbutton_type' => 'small',
'#links' => array(
'demo' => array(
'title' => $this->t('Build Demo'),
'url' => Url::fromRoute('fapi_example.build_demo'),
),
),
);
Remaining tasks
None.
User interface changes
None.
API changes
Optional new #dropbutton_type property on the dropbutton render element.
Data model changes
None.
Release notes snippet
None.
Comments
Comment #2
quironThis patch adds the same logic used for
buttonvariants todropbuttonThe css code applying the small style to the views_ui is:
https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/views_...
Comment #3
quironSorry, extra actions in views edit page should be small and not extrasmall.
Comment #4
lauriiiComment #5
quironFixed patch base directory.
Comment #6
fhaeberleLooks good from my point of view!
Comment #8
fhaeberleMmh, the failing test is strange. Can' see why the test in
/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php:61fails.Can somebody help?
Comment #9
yogeshmpawarAbove test fails are unrelated so setting back to RTBC.
Comment #11
bnjmnmSetting back to RTBC as this was kicked back to needs work due to a random fail in a completely unrelated test.
Comment #12
lauriiiWe should document this in the render element so that when people look at the documentation for dropbutton render element, they can actually see this configuration option.
We should also create a change record to notify people of this new feature.
Comment #13
quironAdded the documentation in the comment.
Also created a draft change record for it https://www.drupal.org/node/3072313
Comment #14
fhaeberleReviewed this and it looks good for me. Added a bit more details to the change record. RTBC.
Comment #15
lauriiiI think we should remove these classes from this patch since these are specific to Claro. Claro would be still responsible for adding these, but it would be easier because of the added support to Dropbutton render element.
Comment #16
fhaeberleRemoved the classes but I'm not sure, what's the default dropbutton class? Or should it default to none?
Comment #17
wim leers#15++ for not adding (contrib) theme-specific values to core code, and certainly to module code.
#16 Yes, it should default to none. Which is exactly what you did in #16 :)
The code in #16 now matches https://git.drupalcode.org/project/drupal/blob/8.8.x/core/lib/Drupal/Cor... exactly. This is now an easy RTBC: it's applying a pre-existing pattern from one render element to another render element 👍
Comment #18
wim leersStill needs change record and issue summary update for the new capability being added here.
Comment #19
wim leersOops, a change record already exists! 😅 👍
Comment #20
lauriiiCommitted e707588 and pushed to 8.8.x. Thanks!