- Issue created by @Anybody
- 🇺🇸United States mark_fullmer Tucson
Alternatively, the fields could be inline by default and responsively become two lines if there's not enough space.
I think this would be preferable, to accommodate various screen widths.
Another consideration would be, for multi-item widgets only, to make each link/title pair be a collapsible fieldset. That probably sounds like a lot for just two text fields, but people will often extend link widgets to add other link options, like "open in new tab" or link icons...
- Merge request !93Issue #3519747: Added a new widget option to display inline url and title fields. → (Open) created by Tirupati_Singh
- 🇮🇳India Tirupati_Singh
Hi @anybody, I've added a new widget option named "Enable Compact Row" to enable/disable display inline fields when using the module. I've attached the screenshots of before and after fixes for reference. Please review the changes.
Thanks!
- 🇩🇪Germany Grevil
I don't think we should use a setting here nor use custom css, but rather work with drupal native classes.
I'd agree with @mark_fullmer's comment in #5 ✨ Provide an inline display field widget setting Active . We have two options:
- The fields will be inline by default and responsively become two lines if there's not enough space
- We put the URL and Title inside a fieldset
I'd vote for option A, what do you think @anybody, @thomas.frobieter, @mark_fullmer?
- 🇩🇪Germany Anybody Porta Westfalica
Yes, I'd also prefer A as a nice improvement. B could be an additional option using a select like we for example know from field groups? Maybe as follow-up?
I haven't looked at the code, but I think this:
"The fields will be inline by default and responsively become two lines if there's not enough space"
should be very easy to achieve and sounds like the best solution.
- Merge request !95Issue #3519747: Provide an inline display field widget setting → (Open) created by Grevil
- 🇩🇪Germany Grevil
Ok, it seems we have to use custom css anyway...
For some reason the class is not set on the container yet. I am not a style guy, so I don't do that very often. Also the css file is just some rude mentally generated AI stuff and far from being finished.
Note, that this should be the correct way to set the class on the container. The parent class does this similiarly:$element['attributes'] = [ '#type' => 'value', '#tree' => TRUE, '#value' => !empty($items[$delta]->options['attributes']) ? $items[$delta]->options['attributes'] : [], '#attributes' => ['class' => ['link-field-widget-attributes']], // <= This is the code in question. ];
@thomas.frobieter would you be able to finish this?
Okay done, please review!
The "critical" part is, that we rely on the "fieldset-wrapper" and "fieldset__wrapper" class, which is used by cores Claro admin theme (also by GIN, which is a child theme of Claro): https://github.com/search?q=repo%3Adrupalux%2Fclaro%20fieldset__wrapper&type=code.
However, this wrapper does not have Drupal attributes, so we are unable to add our own reliable class on it. Good enough for me.- 🇩🇪Germany Anybody Porta Westfalica
Thanks @thomas.frobieter great work! I think that's totally fine. RTBC from my side! :) Really nice improvement, we should suggest this for core link fields widgets as follow-up.
Yes, good idea. I think the core should invent some kind of layout wrapper for the Form API, with attributes for the number of columns, etc. Including the necessary classes + CSS.