Custom Fields
Re-Envisioned › Support › Meta Box Columns › Strange issue with tabs + columns
- This topic has 16 replies, 3 voices, and was last updated 3 years, 7 months ago by
Anh Tran.
-
CreatorTopic
-
July 15, 2017 at 5:23 AM #6321
Try my code
-
CreatorTopic
-
AuthorReplies
-
July 15, 2017 at 5:24 AM #6322
Jackky
Participant*also can’t find any markup buttons for code wrap here, sorry
July 15, 2017 at 5:30 AM #6323Jackky
ParticipantAnd another my thought: maybe it will be more user-friendly to make API looking like this:
fields => array ( columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here or leave empty ), ), )
July 15, 2017 at 9:02 AM #6324Truong Giang
ParticipantHi there,
Please make sure that the total of columns in meta box is multiple of 12, and all fields must have a specific columns value (Атрибуты doesn’t have one)July 15, 2017 at 9:21 AM #6326Anh Tran
KeymasterHi Jackky,
Your idea about column class is nice. Will think about it. The suggested syntax I think will be problematic if we use with groups. So let’s just keep it as it is.
July 17, 2017 at 7:30 AM #6332Jackky
ParticipantNope, that will be easier to use, here an example
fields => array ( columns => array( size => 4, class => 'custom-column-class', fields => array( 'name' => 'Group', // Optional 'id' => 'group_id', 'type' => 'group', // List of sub-fields 'fields' => array( array( 'name' => 'Text', 'id' => 'text', 'type' => 'text', ), // Other sub-fields here ), ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here ), ), columns => array( size => 4, class => 'custom-column-class', fields => array ( //you can add multiple fields here or leave empty ), ), )
July 17, 2017 at 8:20 AM #6333Anh Tran
KeymasterHi, I don’t want to much nested arrays. In case sub-fields in groups are organized in columns, there will be a nightmare of nested nested arrays.
After reviewing the code, I think we can still achieve everything by this code:
fields => array( array( 'columns' => 4, 'class' => 'custom-column-class', ), ),
We have
class
attribute for fields, so let’s use it instead of creating another attribute.July 18, 2017 at 6:25 AM #6347Jackky
ParticipantA nightmare, yes, it will be) But you can add this like advanced markup for those crasy coders, like me) I really need a feature to wrap 2-3 fields in one column and add empty columns to build beautiful UI inside admin area. And I think, I’m not alone with this perfectionism.
Add: also with this type of array markup there will be a feature to make nested columns.
July 18, 2017 at 9:18 AM #6349Anh Tran
KeymasterWe just updated the Columns extension yesterday with a better check for total columns (less than or greater than 12, it will close the div). But if you use with tabs, you still need to make sure total columns in each row equals to 12. Please update.
Regarding the new syntax, I was thinking about something advanced that can offer you more flexibility. But after looking at that, I see the change is only the
fields
parameter (theclass
as I replied can be achieved viaclass
attribute). And with the support of Group extension, you can do that easily, including the nested columns.Here is what you can do with Groups (the syntax is very similar):
'fields' => array( array( 'type' => 'group', // A wrapper group 'id' => 'wrapper', 'fields' => array( array( 'id' => 'name', 'type' => 'text', 'columns' => 4 ), array( 'id' => 'subgroup', 'type' => 'group', 'columns' => 8, 'fields' => array(), // Array of other sub-sub fields ) ), ), ),
July 19, 2017 at 11:44 AM #6363Jackky
ParticipantYes, it’s the solution for someone, but group type saving a serialized array, but I need each value stay single in case to organize searching and filtering on the front. That’s why I’m ready to deal with tonns on nested arrays in the markup example, I gave.)
July 21, 2017 at 7:27 AM #6377Jackky
ParticipantOh, suddenly I’ve got another great idea: just make a flex-grid based extension with a markup, such as I gave. If you like it, I can generate here the full list of options.
-
AuthorReplies
- You must be logged in to reply to this topic.