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.
- ๐ฉ๐ช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.
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 Grevil
grevil โ changed the visibility of the branch 3519747-provide-an-inline to hidden.
- ๐ฉ๐ช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?
- @grevil opened merge request.
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.
- ๐ฉ๐ช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?
- ๐ฉ๐ช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?