michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
339 stars 71 forks source link

Flexible content field group #180

Closed ghost closed 8 years ago

ghost commented 9 years ago

Hi Michael,

Happy new year..

I have used a plugin before for creating custom fields for a small project, and it was called ACF (Advanced Custom Fields) by Elliot Condon.

While I used this plugin for creating a simple layout, I explored the options they had available in the PRO version. What I really loved was something called "Flexible Content Field".

http://www.advancedcustomfields.com/resources/flexible-content/

This was really awesome since it allowed me to make a set of grouped fields, then add them to this area that I wanted. I used this to make a pretty complex , yet easy to use selection of groups for the end user.

Is this something you might consider to add to Admin Page Framework? Here are some screenshots of how I have used it, and you can see how this is quite beneficial to have such an option.

add a flexible content field

flexible content field

flexible content field dragable

michaeluno commented 9 years ago

Indeed, the ability to layout mixed field types in a single field is something I've been thinking how to achieve. Before this, the ability of nested fields should be carried out. Can you suggest the syntax for it, like how the user sets the arguments and what kind of method they would use?

The form builder functionality should be considered separately. And it may be implemented with an admin page builder. If you need those, post new topics.

ghost commented 9 years ago

Form builder is of no real concern right now, but that would be cool if there was such a thing. Again, not needed since this is a development type framework. I am assuming you were referring to a builder like ACF?

As for the idea and how the dev will set these arguments.

Create repeatable/sortable groups. Develop new field ("select_group") to place in an array of which repeatable groups to include.

ghost commented 9 years ago

Hi Michael, Thank you for responding to my other query. I would happily buy into the dev licence if this feature #180, #152 and #170 if they were included as paid features.

michaeluno commented 8 years ago

This is now included in the 3.8.0/main branch.

inline_mixed

Usage

Use the content argument and set a string with placeholders to the first element. The format of placeholders is the same as the one used for the sprintf() function.

In the below example, %1$s is replaced with the first following field and %2$s is replaced with the second field and so on. And in order to set a width, at the moment, you need to set it with the attributes argument with the fieldset key.

inline_mixed Field Type

Set inline_mixed to the type argument and pass an array holding field definitions with different field types to the content argument.

Example

Example code can be found here. Please try it and report issues. Thanks.

[Edit] Updated the usage and removed the deprecated syntax example.

michaeluno commented 8 years ago

Now I think using placeholders is not useful as the embedded field outputs are all enclosed in structured container elements and normal text set along with the placeholders results in having different CSS rules than those embedded field outputs and this requires the user to adjust the style.

So I'm going to change the above syntax to use a new field type,inline_mixed by deprecating the string element with placeholders set in the content argument.

[Edit] Updated the usage in the previous post.