justintadlock / butterbean

A neat little post meta framework.
GNU General Public License v2.0
204 stars 31 forks source link

Maybe combine register_control and register_setting? #10

Closed timiwahalahti closed 8 years ago

timiwahalahti commented 8 years ago

Is there any reason why register_control could not call register_setting internally? It feels little annoying that i need to call both functions for registering one field, when it would be possible to just add sanitize_callback argument to register_control function.

In my opinion, calling register_setting makes code tangled and unnecessarily long especially when there is many fields.

justintadlock commented 8 years ago

How do you propose handling controls with multiple settings?

justintadlock commented 8 years ago

I'm not against the idea of a built-in wrapper function for single-control + single-setting groups.

justintadlock commented 8 years ago

Something like:

$manager->register_field(
    $name,
    $control_args, // Calls `register_control()` internally.
    $setting_args  // Calls `register_setting()` internally.
);

That'd probably work when a control is only tied to a single setting. It's something I've thought about, but I want to get the base functionality down first.

timiwahalahti commented 8 years ago

I see that you added this wrapper function in latest commit, thanks!