Skip to content

Feature/cms 1411 thumb alignment setting for card view designers #17193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: 5.8
Choose a base branch
from

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Apr 28, 2025

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 to true, 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 respect readOnly config. This required a change in Garnish to allow certain buttons to have a tabindex set.

Screenshot 2025-04-28 at 16 50 04

Related issues

cms-1411

Copy link

linear bot commented Apr 28, 2025

@i-just i-just marked this pull request as ready for review April 29, 2025 08:47
@i-just i-just requested a review from brandonkelly April 29, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant