-
Notifications
You must be signed in to change notification settings - Fork 573
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
Feature Request - Field column classes #68
Comments
This was one of the reasons I switched to Human Made's fork before CMB2 rolled around. Would love to see this implemented. I'd assume though that it would apply exclusively to "Grouped" fields since without a groups such columns could produce strange results. That's a nice idea for a workaround though. Will be testing that out a bit. |
There is a filter for the field row classes, |
I've added a |
This is awesome! Extremely useful IMO. Thanks! |
Nice. That will already be a big benefit, and I agree with @JiveDig, the whole tool is targeted toward developers, if we break stuff while building we'll figure it out, this addition just gives us more flexibility to build better. Thanks! |
Great addition. Some field sets can just get too long.... |
If you guys can build a solid proof of concept for making this work w/ columns, then we can get closer to getting into core. |
@DevinWalker if you're referring to the unwieldy nature of the metabox config arrays, one of the goals for a future update is to convert that array to using at least a few helper functions. No matter what though, config can get large/crazy depending on what you're trying to do. |
@jtsternberg proof of concept more then my recipe plugin screenshot? I'm going to convert our row wraps to this method this week... but it will look the same |
@JiveDig yah, proof of concept like make a library (something like https://github.com/WebDevStudios/cmb2-attached-posts) that allows others to do the same, then test it in other scenarios like user profile pages, admin settings pages, front-end forms, etc. Make sense? Or a pull request, but that's harder to get a lot of people using/testing. Basically a workflow similar to WordPress' features-as-plugins concept. |
@jtsternberg no I'm referring to the ability to add columns like the screenshot. I'm fine with the long arrays in the code. |
@DevinWalker ah, makes sense! I bet you and @JiveDig could come up w/ a killer proof of concept. ;) |
Okay, just to clarify... the |
@JiveDig that's correct. It's in core now (in trunk) and will be rolled into the next release. |
### Enhancements * Use the more appropriate `add_meta_boxes` hook for hooking in metaboxes to post-edit screen. Thanks [@inspiraaz](https://github.com/inspiraaz) for reporting. ([#161](CMB2/CMB2#161)) * Add a `row_classes` field param which allows you to add additional classes to the cmb-row wrap. This parameter can take a string, or array, or can take a callback that returns a string or array. The callback will receive `$field_args` as the first argument, and the CMB2_Field `$field` object as the second argument. Reported/requested in [#68](CMB2/CMB2#68). * New constant, `CMB2_LOADED`, which you can use to check if CMB2 is loaded for your plugins/themes with CMB2 dependency. * New hooks, [`cmb2_init_before_hookup` and `cmb2_after_init`](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/filters-and-actions). * New API for adding metaboxes and fields, demonstrated in [`example-functions.php`](https://github.com/WebDevStudios/CMB2/blob/master/example-functions.php). In keeping with backwards-compatibility, the `cmb2_meta_boxes` filter method will still work, but is not recommended. New API includes `new_cmb2_box` helper function to generate a new metabox, and returns a `$cmb` object to add new fields (via the `CMB2::add_field()` and `CMB2::add_group_field()` methods). * New CMB2 method, [`CMB2::remove_field()`](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/filters-and-actions/cmb2_init_%24cmb_id-remove-field.php). * New CMB2_Boxes method, [`CMB2_Boxes::remove()`](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/filters-and-actions/cmb2_init_before_hookup-remove-cmb2-metabox.php). * When clicking on a file/image in the `file`, or `file_list` type, the media modal will open with that image selected. Props [johnsonpaul1014](https://github.com/johnsonpaul1014), ([#120](CMB2/CMB2#120)). git-svn-id: https://plugins.svn.wordpress.org/cmb2/trunk@1090772 b8457f37-d9ea-0310-8a92-e5e31aec5664
I've made a CMB2 plugin for that: CMB2 Grid - A grid system for Wordpress CMB2 library that allows the creation of columns for a better layout in the admin I hope you guys enjoy it and give me a feedback |
Pretty cool work @Pablo-Pacheco - combine that with the ability to add tabs then it's really taking it to the next level. |
Thank you :) It's a good idea |
I happen to come across this thread. What about integrating CMB2 grid directly into the CMB2 core? |
I think this one is a must! |
I am using cmb2-grid but integrated will be the best solution! |
+1 in seeing the cmb2-grid integrated! |
Is it integrated yet? |
no |
Human Made's fork does something similar but i don't like the approach as much.
I used before_row and after_row to wrap my field in
<div class="prefix-one-half">
in order to add different amounts of columns via CSS. I used the CSS from Genesis/Bootstrap for the columns. It works and looks great BUT it adds a wrap around the cmb-row. That causes problems when i need to target all rows via CSS.It would be great to have an attribute for:
columns -> 'one-half first' and columns -> 'one-half'
The same way Genesis does it. The one-half.first clears the float and removes the left margin.
This setting would add the classes right inside the cmb-row div.. for consistency.
The output would be:
Columns would be all the bootstrap/G stuff... one-half one-third one-fourth, two-thirds, etc... Not much CSS involved, it's just getting the attribute/parameter setup.
The text was updated successfully, but these errors were encountered: