Skip to content
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

[4.x] Spacer fieldtype #8326

Merged
merged 3 commits into from
Jun 26, 2023
Merged

Conversation

aerni
Copy link
Contributor

@aerni aerni commented Jun 20, 2023

This PR adds a little utility fieldtype that helps you structure your blueprints and forms. If you've ever encountered awkward field positioning in the CP, especially in combination with conditional fields, this fieldtype is great! I've been using it in several projects, and it's been very useful. I figured it might be a great addition to the core.

The field is very easy to use. Just add it to your blueprint and give it the desired width. The spacer field itself is hidden with CSS visibility: hidden.

Possible use case for the fieldtype on the frontend:

CleanShot 2023-06-19 at 20 09 18@2x

How a form submission would look like:

CleanShot 2023-06-19 at 19 49 07@2x

Add empty view for frontend forms
@aerni
Copy link
Contributor Author

aerni commented Jun 20, 2023

It also crossed my mind that this could be an additional config option to the Hidden fieldtype. I decided to go with a separate fieldtype because I thought it was too confusing to add yet another option affecting the field's visibility. We already have the visibility config. And adding something like visibility: invisible wouldn't make much sense for any other field but this Spacer fieldtype.

@robdekort
Copy link
Contributor

This is a very welcome PR!

@jackmcdade
Copy link
Member

Have long wanted a more elegant solution to this, but as of yet the more elegant the option the bigger the can of worm it opens. So, we'll merge this and hope for inspiration that renders it deprecated some day :)

Also, I made sure it doesn't show up on mobile breakpoints when everything is 100% width anyway.

@jackmcdade jackmcdade merged commit 4af8385 into statamic:4.x Jun 26, 2023
15 checks passed
@aerni aerni deleted the feature/spacer-fieldtype branch December 8, 2023 20:11
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.

None yet

3 participants