Feature/cms 1411 thumb alignment setting for card view designers #17193
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
For field layout designers that use the card view designer, the selection of the field that should serve as the card thumbnail has been moved out of the layout element’s disclosure menu to a separate dropdown field.
It’s complemented by a new “Thumbnail alignment” button group, which allows you to select whether the thumbnail should be aligned to the start or end of the card (left or right in LTR languages, respectively). The default alignment is “end.” Selecting an alignment updates the card preview in the card view designer.
For field layouts for element types that have
hasThumbs()
set totrue
, the “Thumbnail alignment” buttons are shown even if no field is selected from the “Use for element thumbnails” dropdown. For those field layouts, the first and default option reads “Default”, whilst in other cases it’s “None” (indicates no thumbnail should be used for the card).For the field layouts that don’t use card view designer, the selection of the field that should serve as the card thumbnail remains in the disclosure menu (e.g. Globals).
@brandonkelly, LMK if you want to keep it like this for the field layouts that don’t use card view designer. I could change it to still have the alignment buttons, but as there’s no preview, you wouldn’t see that update until you save & view the actual element card.
Added:
src/base/Thumbable::getThumbAlignment()
src/helpers/Cp::buttonGroupHtml()
src/helpers/Cp::buttonGroupFieldHtml()
src/models/FieldLayout::getCardThumbAlignment()
src/models/FieldLayout::setCardThumbAlignment()
Updated
Craft.Listbox
,_includes/forms/button.twig
and_includes/forms/buttonGroup.twig
to respectreadOnly
config. This required a change inGarnish
to allow certain buttons to have atabindex
set.Related issues
cms-1411